diff --git a/app/editor/components/SuggestionsMenu.tsx b/app/editor/components/SuggestionsMenu.tsx index 4c97f29cb..d311008e9 100644 --- a/app/editor/components/SuggestionsMenu.tsx +++ b/app/editor/components/SuggestionsMenu.tsx @@ -186,9 +186,12 @@ function SuggestionsMenu(props: Props) { dispatch( state.tr.insertText( "", - state.selection.from - - (props.search ?? "").length - - (trimTrigger ? props.trigger.length : 0), + Math.max( + 0, + state.selection.from - + (props.search ?? "").length - + (trimTrigger ? props.trigger.length : 0) + ), state.selection.to ) );