From 7eaf7dc881988038dd3af846e4b57341cf7ce123 Mon Sep 17 00:00:00 2001 From: Daniel Kanczuk Date: Mon, 6 Feb 2023 07:49:08 -0300 Subject: [PATCH] fix #140 empty context --- src/core/componentStructure.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/componentStructure.js b/src/core/componentStructure.js index b827b7a..06ebda2 100644 --- a/src/core/componentStructure.js +++ b/src/core/componentStructure.js @@ -1,4 +1,9 @@ -const getHtmlElementFromNode = ({ el }) => el; +const getHtmlElementFromNode = (node) => { + const el = + node.el || (Array.isArray(node.children) && node.children[0].el.parentNode); + return el || {}; +}; + const addContext = (domElement, context) => (domElement.__draggable_context = context); const getContext = domElement => domElement.__draggable_context;