From f67b217b301c8139e3ddf1acdd5d42b6a4c13902 Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Sun, 17 Nov 2024 14:52:33 +0100 Subject: [PATCH] fix(bubble-menu): avoid bluring if event is on the editor (#5835) --- .changeset/pink-avocados-stare.md | 9 +++++++++ packages/extension-bubble-menu/src/bubble-menu-plugin.ts | 6 ++++++ .../extension-floating-menu/src/floating-menu-plugin.ts | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 .changeset/pink-avocados-stare.md diff --git a/.changeset/pink-avocados-stare.md b/.changeset/pink-avocados-stare.md new file mode 100644 index 000000000..072d045df --- /dev/null +++ b/.changeset/pink-avocados-stare.md @@ -0,0 +1,9 @@ +--- +"@tiptap/extension-floating-menu": patch +"@tiptap/extension-bubble-menu": patch +"@tiptap/react": patch +"@tiptap/vue-2": patch +"@tiptap/vue-3": patch +--- + +Fixes an issue where the bubble and flaoting menus on blur would remount diff --git a/packages/extension-bubble-menu/src/bubble-menu-plugin.ts b/packages/extension-bubble-menu/src/bubble-menu-plugin.ts index 1bcfe7109..b699079a1 100644 --- a/packages/extension-bubble-menu/src/bubble-menu-plugin.ts +++ b/packages/extension-bubble-menu/src/bubble-menu-plugin.ts @@ -156,6 +156,12 @@ export class BubbleMenuView { return } + if ( + event?.relatedTarget === this.editor.view.dom + ) { + return + } + this.hide() } diff --git a/packages/extension-floating-menu/src/floating-menu-plugin.ts b/packages/extension-floating-menu/src/floating-menu-plugin.ts index 5db7d7a92..07797f8bc 100644 --- a/packages/extension-floating-menu/src/floating-menu-plugin.ts +++ b/packages/extension-floating-menu/src/floating-menu-plugin.ts @@ -123,6 +123,12 @@ export class FloatingMenuView { return } + if ( + event?.relatedTarget === this.editor.view.dom + ) { + return + } + this.hide() }