This commit is contained in:
Philipp Kühn
2018-09-29 12:34:11 +02:00
parent 7728ca1de0
commit 640094171e
3 changed files with 5 additions and 5 deletions

View File

@@ -184,7 +184,7 @@ export default {
// so it's important to pass also the position of your suggestion text
selectUser(user) {
this.insertMention({
replaceRange: this.suggestionRange,
range: this.suggestionRange,
attrs: {
id: user.id,
label: user.name,

View File

@@ -1,4 +1,4 @@
export default function (pos, type, attrs = {}) {
export default function (range, type, attrs = {}) {
return (state, dispatch) => {
const { $from } = state.selection
const index = $from.index()
@@ -8,7 +8,7 @@ export default function (pos, type, attrs = {}) {
}
if (dispatch) {
dispatch(state.tr.replaceWith(pos.from, pos.to, type.create(attrs)))
dispatch(state.tr.replaceWith(range.from, range.to, type.create(attrs)))
}
return true

View File

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