diff --git a/packages/tiptap/src/Components/EditorFloatingMenu.js b/packages/tiptap/src/Components/EditorFloatingMenu.js index c281c89c..45479bd0 100644 --- a/packages/tiptap/src/Components/EditorFloatingMenu.js +++ b/packages/tiptap/src/Components/EditorFloatingMenu.js @@ -26,6 +26,7 @@ export default { if (editor) { this.$nextTick(() => { editor.registerPlugin(FloatingMenu({ + editor, element: this.$el, onUpdate: menu => { this.menu = menu diff --git a/packages/tiptap/src/Components/EditorMenuBubble.js b/packages/tiptap/src/Components/EditorMenuBubble.js index 3d5e67f4..d55ad0bb 100644 --- a/packages/tiptap/src/Components/EditorMenuBubble.js +++ b/packages/tiptap/src/Components/EditorMenuBubble.js @@ -30,6 +30,7 @@ export default { if (editor) { this.$nextTick(() => { editor.registerPlugin(MenuBubble({ + editor, element: this.$el, keepInBounds: this.keepInBounds, onUpdate: menu => { diff --git a/packages/tiptap/src/Plugins/FloatingMenu.js b/packages/tiptap/src/Plugins/FloatingMenu.js index c2c59c06..04f647eb 100644 --- a/packages/tiptap/src/Plugins/FloatingMenu.js +++ b/packages/tiptap/src/Plugins/FloatingMenu.js @@ -14,7 +14,7 @@ class Menu { this.isActive = false this.top = 0 - this.editorView.dom.addEventListener('blur', this.hide.bind(this)) + this.options.editor.on('blur', this.hide.bind(this)) } update(view, lastState) { @@ -67,10 +67,6 @@ class Menu { this.sendUpdate() } - destroy() { - this.editorView.dom.removeEventListener('blur', this.hide) - } - } export default function (options) { diff --git a/packages/tiptap/src/Plugins/MenuBubble.js b/packages/tiptap/src/Plugins/MenuBubble.js index 3873d9cc..244424e0 100644 --- a/packages/tiptap/src/Plugins/MenuBubble.js +++ b/packages/tiptap/src/Plugins/MenuBubble.js @@ -67,7 +67,7 @@ class Menu { this.left = 0 this.bottom = 0 - this.editorView.dom.addEventListener('blur', this.hide.bind(this)) + this.options.editor.on('blur', this.hide.bind(this)) } update(view, lastState) { @@ -127,10 +127,6 @@ class Menu { this.sendUpdate() } - destroy() { - this.editorView.dom.removeEventListener('blur', this.hide) - } - } export default function (options) {