diff --git a/frontend/src/canvas/context-menu-items.ts b/frontend/src/canvas/context-menu-items.ts index b6c6cea..f1f581d 100644 --- a/frontend/src/canvas/context-menu-items.ts +++ b/frontend/src/canvas/context-menu-items.ts @@ -45,9 +45,13 @@ export function buildContextMenuItems(ctx: MenuContext): MenuItem[] { return [ // -- Clipboard -- - { label: 'Copy', shortcut: 'Ctrl+C', onClick: () => { - if (hasSel) { ctx.clipboardRef.current = [...selected]; ctx.writeCanvasToClipboard(selected); } - else ctx.writeCanvasToClipboard(); + { label: 'Copy', shortcut: 'Ctrl+C', onClick: async () => { + if (hasSel) { + ctx.clipboardRef.current = [...selected]; + await ctx.writeCanvasToClipboard(selected); + } else { + await ctx.writeCanvasToClipboard(); + } } }, { label: 'Cut', shortcut: 'Ctrl+X', onClick: () => { if (!scene || !hasSel || !selection) return; diff --git a/frontend/src/canvas/shortcut-definitions.ts b/frontend/src/canvas/shortcut-definitions.ts index b93a5ec..65ac990 100644 --- a/frontend/src/canvas/shortcut-definitions.ts +++ b/frontend/src/canvas/shortcut-definitions.ts @@ -467,16 +467,16 @@ export const shortcuts: ShortcutDef[] = [ { id: 'copy', keys: { key: 'c', ctrl: true }, category: 'editing', description: 'Copy', - handler: (ctx) => { + handler: async (ctx) => { const selected = ctx.selection.getSelectedItems(); if (selected.length > 0) { // Include group children in clipboard for proper paste ctx.clipboardRef.current = _collectGroupChildren(selected, ctx.scene); markInternalCopy(); - ctx.writeCanvasToClipboard(selected); + await ctx.writeCanvasToClipboard(selected); ctx.showToast('Copied'); } else { - ctx.writeCanvasToClipboard(); + await ctx.writeCanvasToClipboard(); ctx.showToast('Copied canvas'); } }, @@ -484,9 +484,9 @@ export const shortcuts: ShortcutDef[] = [ { id: 'copy-as-image', keys: { key: 'c', ctrl: true, shift: true }, category: 'editing', description: 'Copy as image to clipboard', - handler: (ctx) => { + handler: async (ctx) => { const selected = ctx.selection.getSelectedItems(); - ctx.writeCanvasToClipboard(selected.length > 0 ? selected : undefined); + await ctx.writeCanvasToClipboard(selected.length > 0 ? selected : undefined); }, }, { @@ -512,12 +512,12 @@ export const shortcuts: ShortcutDef[] = [ { id: 'cut', keys: { key: 'x', ctrl: true }, category: 'editing', description: 'Cut', - handler: (ctx) => { + handler: async (ctx) => { const selected = ctx.selection.getSelectedItems(); if (selected.length === 0) return; ctx.clipboardRef.current = _collectGroupChildren(selected, ctx.scene); markInternalCopy(); - ctx.writeCanvasToClipboard(selected); + await ctx.writeCanvasToClipboard(selected); for (const item of selected) { ctx.scene.removeItem(item.id, true); }