From e4a20be5c7635d69deffa461d2091a44c6676888 Mon Sep 17 00:00:00 2001 From: bepsvpt Date: Mon, 30 Mar 2020 16:50:28 +0800 Subject: [PATCH] set capture to true for mousedown event listener --- packages/tiptap/src/Plugins/FloatingMenu.js | 2 +- packages/tiptap/src/Plugins/MenuBar.js | 2 +- packages/tiptap/src/Plugins/MenuBubble.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/tiptap/src/Plugins/FloatingMenu.js b/packages/tiptap/src/Plugins/FloatingMenu.js index 25a8f46d9..c5c6ea1fd 100644 --- a/packages/tiptap/src/Plugins/FloatingMenu.js +++ b/packages/tiptap/src/Plugins/FloatingMenu.js @@ -18,7 +18,7 @@ class Menu { // the mousedown event is fired before blur so we can prevent it this.mousedownHandler = this.handleClick.bind(this) - this.options.element.addEventListener('mousedown', this.mousedownHandler) + this.options.element.addEventListener('mousedown', this.mousedownHandler, { capture: true }) this.options.editor.on('focus', ({ view }) => { this.update(view) diff --git a/packages/tiptap/src/Plugins/MenuBar.js b/packages/tiptap/src/Plugins/MenuBar.js index fb8e1e7e3..b4e6c0de5 100644 --- a/packages/tiptap/src/Plugins/MenuBar.js +++ b/packages/tiptap/src/Plugins/MenuBar.js @@ -8,7 +8,7 @@ class Menu { // the mousedown event is fired before blur so we can prevent it this.mousedownHandler = this.handleClick.bind(this) - this.options.element.addEventListener('mousedown', this.mousedownHandler) + this.options.element.addEventListener('mousedown', this.mousedownHandler, { capture: true }) this.options.editor.on('blur', () => { if (this.preventHide) { diff --git a/packages/tiptap/src/Plugins/MenuBubble.js b/packages/tiptap/src/Plugins/MenuBubble.js index f28681619..d184009b5 100644 --- a/packages/tiptap/src/Plugins/MenuBubble.js +++ b/packages/tiptap/src/Plugins/MenuBubble.js @@ -71,7 +71,7 @@ class Menu { // the mousedown event is fired before blur so we can prevent it this.mousedownHandler = this.handleClick.bind(this) - this.options.element.addEventListener('mousedown', this.mousedownHandler) + this.options.element.addEventListener('mousedown', this.mousedownHandler, { capture: true }) this.options.editor.on('focus', ({ view }) => { this.update(view)