From 4cf9220ef4828bb3436a8dd3a0e75e4242532fb5 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 1 Aug 2018 12:36:02 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Koenig=20-=20Fixed=20duplicate?= =?UTF-8?q?=20images=20when=20dropping=20image=20file=20on=20an=20image=20?= =?UTF-8?q?card?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Ghost/issues/9724 - `card.handlesDragDrop` was never accessible, it would have had to be registered through `card.koenigOptions.handlesDragDrop` when the drop handling was first added - as of https://github.com/TryGhost/Ghost-Admin/commit/cc2e20a48691b592d11a709d1f791669f398a00b properties on card components are directly accessible so we can use `card.component.handlesDragDrop` to guard against the editor handling drops on cards that handle their own drops --- ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js | 2 +- ghost/admin/lib/koenig-editor/addon/options/cards.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 ce2d0c67bb..321e79de24 100644 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js +++ b/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js @@ -902,7 +902,7 @@ export default Component.extend({ if (cardElem) { let cardId = cardElem.firstChild.id; let card = this.componentCards.findBy('destinationElementId', cardId); - if (card.isEditing || card.handlesDragDrop) { + if (card.isEditing || card.component.handlesDragDrop) { return; } } diff --git a/ghost/admin/lib/koenig-editor/addon/options/cards.js b/ghost/admin/lib/koenig-editor/addon/options/cards.js index 3f64fc58d4..6a89b147b2 100644 --- a/ghost/admin/lib/koenig-editor/addon/options/cards.js +++ b/ghost/admin/lib/koenig-editor/addon/options/cards.js @@ -1,5 +1,7 @@ import createComponentCard from '../utils/create-component-card'; +// TODO: move koenigOptions directly into cards now that card components register +// themselves so that they are available on card.component export default [ createComponentCard('card-markdown'), // backwards-compat with markdown editor createComponentCard('code', {deleteIfEmpty: 'payload.code'}),