fix: slash menu - stopPropagation on mousedown blocks ProseMirror selectionUpdate
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
This commit is contained in:
@@ -483,10 +483,11 @@ function SlashCommandMenu({ editor, onInsertImage }: { editor: Editor; onInsertI
|
|||||||
ref={menuRef}
|
ref={menuRef}
|
||||||
className="notion-slash-menu"
|
className="notion-slash-menu"
|
||||||
style={{ top: coords.top, left: coords.left }}
|
style={{ top: coords.top, left: coords.left }}
|
||||||
onMouseDown={() => {
|
onMouseDown={(e) => {
|
||||||
// Block selectionUpdate handler while interacting with menu
|
e.preventDefault() // prevent editor from losing focus
|
||||||
|
e.stopPropagation() // prevent ProseMirror from seeing the mousedown → no selectionUpdate
|
||||||
menuInteracting.current = true
|
menuInteracting.current = true
|
||||||
setTimeout(() => { menuInteracting.current = false }, 200)
|
setTimeout(() => { menuInteracting.current = false }, 300)
|
||||||
}}
|
}}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user