From 511578388e55389180df3c8826707b74269835c5 Mon Sep 17 00:00:00 2001 From: Andreas Tzionis Date: Wed, 23 Oct 2024 02:48:01 +0300 Subject: [PATCH] minor fix --- lib/client/vanilla/editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client/vanilla/editor.tsx b/lib/client/vanilla/editor.tsx index db443290..3930db83 100644 --- a/lib/client/vanilla/editor.tsx +++ b/lib/client/vanilla/editor.tsx @@ -209,9 +209,9 @@ function Editor({ standaloneServer = false }) { const _components = getComponents() if (_components.length === 0) { canvasRef.current!.innerHTML = html - } else if (isElementTopHalf(hoveredComponent!, e)) { + } else if (hoveredComponent && isElementTopHalf(hoveredComponent!, e)) { hoveredComponent!.insertAdjacentHTML('beforebegin', html) - } else if (!isElementTopHalf(hoveredComponent!, e)) { + } else if (hoveredComponent && !isElementTopHalf(hoveredComponent!, e)) { hoveredComponent!.insertAdjacentHTML('afterend', html) }