Skip to content

Commit b54b39f

Browse files
authored
Merge pull request #119 from j4rviscmd/fix/color-picker-toolbar-dismiss
fix(editor): prevent padding click handler from closing toolbar on button clicks
2 parents 96d9698 + ba2e89d commit b54b39f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/features/editor/ui/Editor.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,18 +567,18 @@ export const Editor = forwardRef<EditorHandle, EditorProps>(function Editor(
567567
* 1. **Locked mode** – when the editor is read-only (`locked` is `true`),
568568
* the callback is a no-op so that clicking the padding area does not
569569
* steal focus or move the cursor.
570-
* 2. **Inside `.bn-editor`** – if the click originated inside the
571-
* contenteditable region (including any descendant elements), the
572-
* callback returns early and lets the default browser behaviour handle
573-
* focus normally.
570+
* 2. **Inside `.bn-container`** – if the click originated inside the
571+
* BlockNote container (including the editor, toolbars, menus, and other
572+
* UI overlays), the callback returns early and lets the default browser
573+
* behaviour handle focus normally.
574574
*
575575
* @param e - The React mouse event from the wrapper `<div>`.
576576
*/
577577
const handleWrapperClick = useCallback(
578578
(e: React.MouseEvent<HTMLDivElement>) => {
579579
if (locked) return
580580
const target = e.target as HTMLElement
581-
if (target.closest('.bn-editor')) return
581+
if (target.closest('.bn-container')) return
582582
if (target.closest('[role="dialog"]')) return
583583

584584
const lastBlock = editor.document[editor.document.length - 1]

0 commit comments

Comments
 (0)