OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.
TypeScript
fix: restore drag-and-drop import in assets panel (#55)
Emmanuel Yeboahd00f3567f705
diff --git a/apps/web/src/components/editor/AssetsPanel.tsx b/apps/web/src/components/editor/AssetsPanel.tsxindex c69d66a0..df34ea77 100644--- a/apps/web/src/components/editor/AssetsPanel.tsx+++ b/apps/web/src/components/editor/AssetsPanel.tsx@@ -626,26 +626,28 @@ export const AssetsPanel: React.FC = () => {e.preventDefault();setIsDragOver(false);- // Try to capture handles before files are consumed- if ("getAsFileSystemHandle" in DataTransferItem.prototype) {- const handlePromises = Array.from(e.dataTransfer.items)- .filter((item) => item.kind === "file")- .map(async (item) => {- try {- const handle = await (item as DataTransferItem & { getAsFileSystemHandle(): Promise<FileSystemHandle> }).getAsFileSystemHandle();- if (handle.kind === "file") {- const fileHandle = handle as FileSystemFileHandle;- const file = await fileHandle.getFile();- await saveFileHandle(file.name, file.size, fileHandle);- }- } catch {- // Ignore — handle capture is best-effort- }- });- await Promise.all(handlePromises);- }+ // Snapshot dataTransfer synchronously — it becomes inert after the first await.+ const droppedFiles = e.dataTransfer.files;+ const handlePromises =+ "getAsFileSystemHandle" in DataTransferItem.prototype+ ? Array.from(e.dataTransfer.items)+ .filter((item) => item.kind === "file")+ .map(async (item) => {+ try {+ const handle = await (item as DataTransferItem & { getAsFileSystemHandle(): Promise<FileSystemHandle> }).getAsFileSystemHandle();+ if (handle.kind === "file") {+ const fileHandle = handle as FileSystemFileHandle;+ const file = await fileHandle.getFile();+ await saveFileHandle(file.name, file.size, fileHandle);+ }+ } catch {+ // Ignore — handle capture is best-effort+ }+ })+ : [];- handleFileImport(e.dataTransfer.files);+ await Promise.all(handlePromises);+ handleFileImport(droppedFiles);},[handleFileImport],);diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 72b9d538..02616541 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -18,22 +18,6 @@ importers:specifier: ^1.25.3version: 1.25.3- apps/cloud:- dependencies:- hono:- specifier: ^4.11.4- version: 4.12.8- devDependencies:- '@cloudflare/workers-types':- specifier: ^4.20260117.0- version: 4.20260117.0- typescript:- specifier: ^5.5.2- version: 5.9.3- wrangler:- specifier: ^3.101.0- version: 3.114.17(@cloudflare/[email protected])-apps/image:dependencies:'@imgly/background-removal':@@ -2687,10 +2671,6 @@ packages:resolution: {integrity: sha512-PDEfEF102G23vHmPhLyPboFCD+BkMGu+GuJe2d9/eH4FsCwvgBpnc9n0pGE+ffKdph38s6foEZiEjdgHdzp+IA==}- resolution: {integrity: sha512-VJCEvtrezO1IAR+kqEYnxUOoStaQPGrCmX3j4wDTNOcD1uRPFpGlwQUIW8niPuvHXaTUxeOUl5MMDGrl+tmO9A==}- engines: {node: '>=16.9.0'}-resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}engines: {node: '>=18'}@@ -3897,7 +3877,8 @@ snapshots:'@cloudflare/[email protected]':optional: true- '@cloudflare/[email protected]': {}+ '@cloudflare/[email protected]':+ optional: true'@cspotcode/[email protected]':dependencies:@@ -5867,8 +5848,6 @@ snapshots:- [email protected]: {}-dependencies:whatwg-encoding: 3.1.1