rename some args

This commit is contained in:
Philipp Kühn
2018-09-29 13:18:36 +02:00
parent 0ef1bc800e
commit de75e70e51

View File

@@ -47,8 +47,8 @@ function triggerCharacter({
from, from,
to, to,
}, },
text: match[0].slice(char.length), query: match[0].slice(char.length),
fullText: match[0], text: match[0],
} }
} }
} }
@@ -90,7 +90,7 @@ export default function SuggestionsPlugin({
const moved = prev.active && next.active && prev.range.from !== next.range.from const moved = prev.active && next.active && prev.range.from !== next.range.from
const started = !prev.active && next.active const started = !prev.active && next.active
const stopped = prev.active && !next.active const stopped = prev.active && !next.active
const changed = !started && !stopped && prev.text !== next.text const changed = !started && !stopped && prev.query !== next.query
const handleStart = started || moved const handleStart = started || moved
const handleChange = changed && !moved const handleChange = changed && !moved
const handleExit = stopped || moved const handleExit = stopped || moved
@@ -116,11 +116,11 @@ export default function SuggestionsPlugin({
const props = { const props = {
view, view,
range: state.range, range: state.range,
query: state.text, query: state.query,
text: state.fullText, text: state.text,
decorationNode, decorationNode,
virtualNode, virtualNode,
items: onFilter(items, state.text), items: onFilter(items, state.query),
command: ({ range, attrs }) => { command: ({ range, attrs }) => {
command({ command({
range, range,
@@ -153,8 +153,8 @@ export default function SuggestionsPlugin({
return { return {
active: false, active: false,
range: {}, range: {},
query: null,
text: null, text: null,
fullText: null,
} }
}, },
@@ -180,8 +180,8 @@ export default function SuggestionsPlugin({
next.active = true next.active = true
next.decorationId = prev.decorationId ? prev.decorationId : decorationId next.decorationId = prev.decorationId ? prev.decorationId : decorationId
next.range = match.range next.range = match.range
next.query = match.query
next.text = match.text next.text = match.text
next.fullText = match.fullText
} else { } else {
next.active = false next.active = false
} }
@@ -193,8 +193,8 @@ export default function SuggestionsPlugin({
if (!next.active) { if (!next.active) {
next.decorationId = null next.decorationId = null
next.range = {} next.range = {}
next.query = null
next.text = null next.text = null
next.fullText = null
} }
return next return next