Skip to content

Commit

Permalink
include bubble menu element when checking if the editor view still ha…
Browse files Browse the repository at this point in the history
…s focus
  • Loading branch information
StefKors committed Sep 2, 2022
1 parent 19d2929 commit 4eaa822
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/extension-bubble-menu/src/bubble-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ export class BubbleMenuView {
const isEmptyTextBlock = !doc.textBetween(from, to).length
&& isTextSelection(state.selection)

// When clicking on a element inside the bubble menu the editor "blur" event
// is called and the bubble menu item is focussed. In this case we should
// consider the menu as part of the ditor and keep showing the menu
const isChildOfMenu = this.element.contains(document.activeElement)

const hasEditorFocus = view.hasFocus() || isChildOfMenu

if (
!view.hasFocus()
!hasEditorFocus
|| empty
|| isEmptyTextBlock
) {
Expand Down

0 comments on commit 4eaa822

Please sign in to comment.