fix: fix a bug for empty node selection where the bubble menu should not be visible, fix #1023

This commit is contained in:
Philipp Kühn
2021-04-21 23:38:13 +02:00
parent d731b1ff8d
commit 8ed220a12d

View File

@@ -88,9 +88,17 @@ export class BubbleMenuView {
return return
} }
const { from, to, empty } = selection const {
from,
to,
empty,
$anchor,
} = selection
if (empty) { // Sometime check for `empty` is not enough.
// Doubleclick an empty paragraph returns a node size of 2.
// So we check also for an empty text size.
if (empty || !$anchor.parent.textContent) {
this.hide() this.hide()
return return