Skip to content

Commit

Permalink
fix(extension-bubble-menu): don't debounce without valid selection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
svenadlung authored Dec 6, 2022
1 parent 5682d04 commit e9d9d88
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/extension-bubble-menu/src/bubble-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,10 @@ export class BubbleMenuView {
const { state } = view
const hasValidSelection = state.selection.$from.pos !== state.selection.$to.pos

if (hasValidSelection) {
if (this.updateDelay > 0) {
debounce(this.updateHandler, this.updateDelay)(view, oldState)
} else {
this.updateHandler(view, oldState)
}
if (this.updateDelay > 0 && hasValidSelection) {
debounce(this.updateHandler, this.updateDelay)(view, oldState)
} else {
this.hide()
this.updateHandler(view, oldState)
}
}

Expand Down

0 comments on commit e9d9d88

Please sign in to comment.