remove replaceRange from mention node
This commit is contained in:
@@ -26,8 +26,8 @@ export const insertContentAt: RawCommands['insertContentAt'] = (range, value) =>
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tr.selection.empty) {
|
if (range.from !== range.to) {
|
||||||
tr.deleteRange(range.from, range.to)
|
tr.delete(range.from, range.to)
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.insert(range.from, content)
|
tr.insert(range.from, content)
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ export const Mention = Node.create<MentionOptions>({
|
|||||||
editor
|
editor
|
||||||
.chain()
|
.chain()
|
||||||
.focus()
|
.focus()
|
||||||
.replaceRange(range, 'mention', props)
|
.insertContentAt(range, {
|
||||||
|
type: 'mention',
|
||||||
|
attrs: props,
|
||||||
|
})
|
||||||
.insertContent(' ')
|
.insertContent(' ')
|
||||||
.run()
|
.run()
|
||||||
},
|
},
|
||||||
allow: ({ editor, range }) => {
|
allow: ({ editor, range }) => {
|
||||||
return editor.can().replaceRange(range, 'mention')
|
return editor.can().insertContentAt(range, { type: 'mention' })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user