From a7d90f7eac90966920c750134d7de9b611b2c38f Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Thu, 28 Aug 2025 22:37:51 +0200 Subject: feat: copy/pasting for elements --- apps/web/src/hooks/use-editor-actions.ts | 17 +++++++++++++++++ apps/web/src/hooks/use-keyboard-shortcuts-help.ts | 8 ++++++++ 2 files changed, 25 insertions(+) (limited to 'apps/web/src/hooks') diff --git a/apps/web/src/hooks/use-editor-actions.ts b/apps/web/src/hooks/use-editor-actions.ts index 81500416..974f9db5 100644 --- a/apps/web/src/hooks/use-editor-actions.ts +++ b/apps/web/src/hooks/use-editor-actions.ts @@ -202,6 +202,23 @@ export function useEditorActions() { undefined ); + useActionHandler( + "copy-selected", + () => { + if (selectedElements.length === 0) return; + useTimelineStore.getState().copySelected(); + }, + undefined + ); + + useActionHandler( + "paste-selected", + () => { + useTimelineStore.getState().pasteAtTime(currentTime); + }, + undefined + ); + useActionHandler( "toggle-snapping", () => { diff --git a/apps/web/src/hooks/use-keyboard-shortcuts-help.ts b/apps/web/src/hooks/use-keyboard-shortcuts-help.ts index e2cde3b4..29e3c09b 100644 --- a/apps/web/src/hooks/use-keyboard-shortcuts-help.ts +++ b/apps/web/src/hooks/use-keyboard-shortcuts-help.ts @@ -63,6 +63,14 @@ const actionDescriptions: Record< "toggle-snapping": { description: "Toggle snapping", category: "Editing" }, undo: { description: "Undo", category: "History" }, redo: { description: "Redo", category: "History" }, + "copy-selected": { + description: "Copy selected elements", + category: "Editing", + }, + "paste-selected": { + description: "Paste elements at playhead", + category: "Editing", + }, }; // Convert key binding format to display format -- cgit v1.3.1