From f24f6e5d0d9d047276dc0d488ef4843fe095024f Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 9 Mar 2021 17:56:27 +0000 Subject: [PATCH] Fixed editor drag/drop getting stuck no issue - sometimes it was possible for a drop target element to not have a child which would cause an error and cause drag/drop to get stuck with the dragged element sticking to the cursor with no action occurring on mouseup, requiring an `Esc` press but all further drags also being broken - added a guard so we can handle `element.firstChild` not existing --- .../lib/koenig-editor/addon/components/koenig-editor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js b/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js index c8519cc772..35c14d8694 100644 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js +++ b/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js @@ -1234,9 +1234,11 @@ export default Component.extend({ return; } - let cardId = cardElement.firstChild.id; + let cardId = cardElement.firstChild?.id; - return this.componentCards.findBy('destinationElementId', cardId); + if (cardId) { + return this.componentCards.findBy('destinationElementId', cardId); + } }, getSectionFromCard(card) {