From 8d816bd315c29110399a2625547015b139f73781 Mon Sep 17 00:00:00 2001 From: Janis Kelemen Date: Fri, 24 Jan 2020 12:53:56 +0100 Subject: [PATCH] Fix error in hide event Sometimes the hide event throws an error since the element of the option does not have a parent node. I added a check if the parent node is not null to the hide event. ```javascript tiptap.esm.js?cd42:1849 Uncaught TypeError: Cannot read property 'contains' of null at Menu.hide (tiptap.esm.js?cd42:1849) at Editor.eval (tiptap.esm.js?cd42:1778) at eval (tiptap.esm.js?cd42:461) at Array.forEach () at Editor.emit (tiptap.esm.js?cd42:460) at Plugin.blur (tiptap.esm.js?cd42:1184) at eval (index.es.js?576a:3113) at EditorView.someProp (index.es.js?576a:4567) at runCustomHandler (index.es.js?576a:3111) at HTMLDivElement.view.dom.addEventListener.view.eventHandlers. (index.es.js?576a:3076) ``` --- packages/tiptap/src/Plugins/FloatingMenu.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tiptap/src/Plugins/FloatingMenu.js b/packages/tiptap/src/Plugins/FloatingMenu.js index 49345e801..25a8f46d9 100644 --- a/packages/tiptap/src/Plugins/FloatingMenu.js +++ b/packages/tiptap/src/Plugins/FloatingMenu.js @@ -100,6 +100,7 @@ class Menu { hide(event) { if (event && event.relatedTarget + && this.options.element.parentNode && this.options.element.parentNode.contains(event.relatedTarget) ) { return