Skip to content

Commit

Permalink
fix: fix a bug for empty node selection where the bubble menu should …
Browse files Browse the repository at this point in the history
…not be visible, fix #1023
  • Loading branch information
philippkuehn committed Apr 21, 2021
1 parent d731b1f commit 8ed220a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/extension-bubble-menu/src/bubble-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,17 @@ export class BubbleMenuView {
return
}

const { from, to, empty } = selection

if (empty) {
const {
from,
to,
empty,
$anchor,
} = selection

// 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()

return
Expand Down

0 comments on commit 8ed220a

Please sign in to comment.