fix bug in suggestion extension, fix #143
This commit is contained in:
@@ -38,9 +38,9 @@ export function findSuggestionMatch(config: Trigger): SuggestionMatch {
|
|||||||
const textFrom = $position.before()
|
const textFrom = $position.before()
|
||||||
const textTo = $position.pos
|
const textTo = $position.pos
|
||||||
const text = $position.doc.textBetween(textFrom, textTo, '\0', '\0')
|
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
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,16 +101,16 @@ export function Suggestion({
|
|||||||
clientRect: () => decorationNode?.getBoundingClientRect() || null,
|
clientRect: () => decorationNode?.getBoundingClientRect() || null,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleStart) {
|
if (handleExit) {
|
||||||
renderer?.onStart?.(props)
|
renderer?.onExit?.(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleChange) {
|
if (handleChange) {
|
||||||
renderer?.onUpdate?.(props)
|
renderer?.onUpdate?.(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleExit) {
|
if (handleStart) {
|
||||||
renderer?.onExit?.(props)
|
renderer?.onStart?.(props)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user