Skip to content

Commit 5ce66cd

Browse files
authored
Merge pull request #646 from Juice-Codes/fix-issue-485
set capture to true for mousedown event listener
2 parents 6d9c878 + e4a20be commit 5ce66cd

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/tiptap/src/Plugins/FloatingMenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Menu {
1818

1919
// the mousedown event is fired before blur so we can prevent it
2020
this.mousedownHandler = this.handleClick.bind(this)
21-
this.options.element.addEventListener('mousedown', this.mousedownHandler)
21+
this.options.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })
2222

2323
this.options.editor.on('focus', ({ view }) => {
2424
this.update(view)

packages/tiptap/src/Plugins/MenuBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Menu {
88

99
// the mousedown event is fired before blur so we can prevent it
1010
this.mousedownHandler = this.handleClick.bind(this)
11-
this.options.element.addEventListener('mousedown', this.mousedownHandler)
11+
this.options.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })
1212

1313
this.options.editor.on('blur', () => {
1414
if (this.preventHide) {

packages/tiptap/src/Plugins/MenuBubble.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Menu {
7171

7272
// the mousedown event is fired before blur so we can prevent it
7373
this.mousedownHandler = this.handleClick.bind(this)
74-
this.options.element.addEventListener('mousedown', this.mousedownHandler)
74+
this.options.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })
7575

7676
this.options.editor.on('focus', ({ view }) => {
7777
this.update(view)

0 commit comments

Comments
 (0)