fix: RangeError: Position -1 out of range

This commit is contained in:
Tom Moor
2023-10-17 18:20:57 -04:00
parent 03869784be
commit ea97963feb

View File

@@ -186,9 +186,12 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
dispatch( dispatch(
state.tr.insertText( state.tr.insertText(
"", "",
state.selection.from - Math.max(
(props.search ?? "").length - 0,
(trimTrigger ? props.trigger.length : 0), state.selection.from -
(props.search ?? "").length -
(trimTrigger ? props.trigger.length : 0)
),
state.selection.to state.selection.to
) )
); );