From f260e1cee400edbe259e3c86004e8d433685d2fd Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Thu, 23 Apr 2026 14:28:11 -0700 Subject: [PATCH] PageEditor: drop video items only on the HTML moodboard tab Early-returns in both gallery-drop handlers when the item's mediaClass is "video" and the active tab can't render video: - 3D tab: already branches image vs dimensional; video would fall into the image branch and try to uploadPlaneFromMediaToken against a video URL. Skip it. - 2D / Konva moodboard: their drop listeners call addImage unconditionally, which would load the video URL into an HTMLImageElement and fail. Skip unless the active tab is MOODBOARD_HTML. Gallery drag is globally enabled in the sibling commit, so this is the failsafe that keeps drops on non-video tabs from producing broken state. --- .../artcraft/app/src/pages/PageEnigma/PageEditor.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/apps/artcraft/app/src/pages/PageEnigma/PageEditor.tsx b/frontend/apps/artcraft/app/src/pages/PageEnigma/PageEditor.tsx index 61833de42a..c33088fc11 100644 --- a/frontend/apps/artcraft/app/src/pages/PageEnigma/PageEditor.tsx +++ b/frontend/apps/artcraft/app/src/pages/PageEnigma/PageEditor.tsx @@ -315,6 +315,10 @@ export const PageEditor = () => { if (tabStore.activeTabId === "3D") { handler = onImageDrop( (item: GalleryItem, position: { x: number; y: number }) => { + // Video drops are only handled on the HTML moodboard. Drop on 3D + // silently — the gallery allows the drag globally, but only tabs + // that know how to render video should consume it. + if (item.mediaClass === "video") return; console.log("3D Drop debug (event):", { editorEngine, camera: editorEngine?.camera, @@ -407,6 +411,12 @@ export const PageEditor = () => { const activeTab = tabStore.activeTabId; handler = onImageDrop( (item: GalleryItem, position: { x: number; y: number }) => { + // Only the HTML moodboard renders videos. Silently ignore video + // drops on the Konva 2D canvas and the Konva moodboard, which + // would otherwise try to load the video URL as an image. + if (item.mediaClass === "video" && activeTab !== "MOODBOARD_HTML") { + return; + } // Find the drop target element. For the HTML moodboard tab there's // no ; use the HTML stage container element instead. const target: Element | null =