From f7ff2f8dfd3a050168a8274abf1811c4c0241655 Mon Sep 17 00:00:00 2001 From: sepehr Date: Sat, 2 May 2026 22:20:48 +0200 Subject: [PATCH] fix: slash menu - stopPropagation on mousedown blocks ProseMirror selectionUpdate --- memento-note/components/rich-text-editor.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/memento-note/components/rich-text-editor.tsx b/memento-note/components/rich-text-editor.tsx index 3046925..c4ceb9b 100644 --- a/memento-note/components/rich-text-editor.tsx +++ b/memento-note/components/rich-text-editor.tsx @@ -483,10 +483,11 @@ function SlashCommandMenu({ editor, onInsertImage }: { editor: Editor; onInsertI ref={menuRef} className="notion-slash-menu" style={{ top: coords.top, left: coords.left }} - onMouseDown={() => { - // Block selectionUpdate handler while interacting with menu + onMouseDown={(e) => { + e.preventDefault() // prevent editor from losing focus + e.stopPropagation() // prevent ProseMirror from seeing the mousedown → no selectionUpdate menuInteracting.current = true - setTimeout(() => { menuInteracting.current = false }, 200) + setTimeout(() => { menuInteracting.current = false }, 300) }} onClick={(e) => e.stopPropagation()} >