fix bug in suggestion extension, fix #143

This commit is contained in:
Philipp Kühn 2021-02-07 20:00:13 +01:00
parent 7d15e5afb9
commit aef0acf53d
2 changed files with 6 additions and 6 deletions

View File

@ -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
}

View File

@ -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)
}
},
}