mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 04:19:02 +08:00
remove replaceRange from mention node
This commit is contained in:
parent
ec838a11f2
commit
63902d4bdb
@ -26,8 +26,8 @@ export const insertContentAt: RawCommands['insertContentAt'] = (range, value) =>
|
||||
return true
|
||||
}
|
||||
|
||||
if (!tr.selection.empty) {
|
||||
tr.deleteRange(range.from, range.to)
|
||||
if (range.from !== range.to) {
|
||||
tr.delete(range.from, range.to)
|
||||
}
|
||||
|
||||
tr.insert(range.from, content)
|
||||
|
@ -17,12 +17,15 @@ export const Mention = Node.create<MentionOptions>({
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.replaceRange(range, 'mention', props)
|
||||
.insertContentAt(range, {
|
||||
type: 'mention',
|
||||
attrs: props,
|
||||
})
|
||||
.insertContent(' ')
|
||||
.run()
|
||||
},
|
||||
allow: ({ editor, range }) => {
|
||||
return editor.can().replaceRange(range, 'mention')
|
||||
return editor.can().insertContentAt(range, { type: 'mention' })
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user