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}
|
||||
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()}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user