include bubble menu element when checking if the editor view still has focus (#3150)

This commit is contained in:
Stef Kors
2022-09-03 20:07:41 +02:00
committed by GitHub
parent 0263629ba5
commit 73daee9b80

View File

@@ -55,8 +55,15 @@ export class BubbleMenuView {
const isEmptyTextBlock = !doc.textBetween(from, to).length const isEmptyTextBlock = !doc.textBetween(from, to).length
&& isTextSelection(state.selection) && 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 ( if (
!view.hasFocus() !hasEditorFocus
|| empty || empty
|| isEmptyTextBlock || isEmptyTextBlock
) { ) {