From 2aeee1b1f402cd2006a9f86b0450efb8db003e73 Mon Sep 17 00:00:00 2001 From: Enrique Santos Date: Thu, 14 Mar 2024 15:38:40 -0300 Subject: [PATCH] fix: not show bubble menu if editor cannot be editable --- packages/headless/src/components/editor-bubble.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/headless/src/components/editor-bubble.tsx b/packages/headless/src/components/editor-bubble.tsx index 26acccb3f..a7ed69eaf 100644 --- a/packages/headless/src/components/editor-bubble.tsx +++ b/packages/headless/src/components/editor-bubble.tsx @@ -26,10 +26,16 @@ export const EditorBubble = forwardRef( const { empty } = selection; // don't show bubble menu if: + // - the editor is not editable // - the selected node is an image // - the selection is empty // - the selection is a node selection (for drag handles) - if (editor.isActive("image") || empty || isNodeSelection(selection)) { + if ( + !editor.isEditable || + editor.isActive("image") || + empty || + isNodeSelection(selection) + ) { return false; } return true; @@ -58,7 +64,7 @@ export const EditorBubble = forwardRef( ); - } + }, ); EditorBubble.displayName = "EditorBubble";