refactoring

This commit is contained in:
Philipp Kühn
2018-09-29 12:33:18 +02:00
parent 20466b2819
commit 7728ca1de0
3 changed files with 48 additions and 15 deletions

View File

@@ -48,8 +48,8 @@ export default class MentionNode extends Node {
allowSpaces: false,
startOfLine: false,
},
command: ({ position, attrs, schema }) => {
return replaceText(position, schema.nodes.mention, attrs)
command: ({ range, attrs, schema }) => {
return replaceText(range, schema.nodes.mention, attrs)
},
items: this.options.items,
onEnter: this.options.onEnter,

View File

@@ -146,9 +146,9 @@ export default function SuggestionsPlugin({
decorationNode,
virtualNode,
items: onFilter(items, next.text),
command: ({ position, attrs }) => {
command: ({ replaceRange, attrs }) => {
command({
position,
range: replaceRange,
attrs,
schema: view.state.schema,
})(view.state, view.dispatch, view)