mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
fix bug in suggestion extension, fix #143
This commit is contained in:
parent
7d15e5afb9
commit
aef0acf53d
@ -38,9 +38,9 @@ export function findSuggestionMatch(config: Trigger): SuggestionMatch {
|
||||
const textFrom = $position.before()
|
||||
const textTo = $position.pos
|
||||
const text = $position.doc.textBetween(textFrom, textTo, '\0', '\0')
|
||||
const match = regexp.exec(text)
|
||||
const match = Array.from(text.matchAll(regexp)).pop()
|
||||
|
||||
if (!match) {
|
||||
if (!match || match.input === undefined || match.index === undefined) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -101,16 +101,16 @@ export function Suggestion({
|
||||
clientRect: () => decorationNode?.getBoundingClientRect() || null,
|
||||
}
|
||||
|
||||
if (handleStart) {
|
||||
renderer?.onStart?.(props)
|
||||
if (handleExit) {
|
||||
renderer?.onExit?.(props)
|
||||
}
|
||||
|
||||
if (handleChange) {
|
||||
renderer?.onUpdate?.(props)
|
||||
}
|
||||
|
||||
if (handleExit) {
|
||||
renderer?.onExit?.(props)
|
||||
if (handleStart) {
|
||||
renderer?.onStart?.(props)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user