Skip to content

Commit

Permalink
fix: not show bubble menu if editor cannot be editable
Browse files Browse the repository at this point in the history
  • Loading branch information
EnriqueSantos-dev committed Mar 14, 2024
1 parent 1441bef commit 2aeee1b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/headless/src/components/editor-bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ export const EditorBubble = forwardRef<HTMLDivElement, EditorBubbleProps>(
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;
Expand Down Expand Up @@ -58,7 +64,7 @@ export const EditorBubble = forwardRef<HTMLDivElement, EditorBubbleProps>(
</BubbleMenu>
</div>
);
}
},
);

EditorBubble.displayName = "EditorBubble";
Expand Down

0 comments on commit 2aeee1b

Please sign in to comment.