summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/commands/timeline/clipboard/paste.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-13 04:40:56 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-13 05:03:10 +0200
commit2272598d420cf078aaa3928246bfa3a414f6eddb (patch)
treeb52460a2e3576c9e517ef8a9dd86959a68f31b69 /apps/web/src/lib/commands/timeline/clipboard/paste.ts
parent5a2aaf3601b6b050603f51e487a31fb07862a21f (diff)
downloadopencut-2272598d420cf078aaa3928246bfa3a414f6eddb.tar.gz
feat: clipboard with keyframe paste
Made-with: Cursor
Diffstat (limited to 'apps/web/src/lib/commands/timeline/clipboard/paste.ts')
-rw-r--r--apps/web/src/lib/commands/timeline/clipboard/paste.ts19
1 files changed, 8 insertions, 11 deletions
diff --git a/apps/web/src/lib/commands/timeline/clipboard/paste.ts b/apps/web/src/lib/commands/timeline/clipboard/paste.ts
index 6ccf96fb..347c4f68 100644
--- a/apps/web/src/lib/commands/timeline/clipboard/paste.ts
+++ b/apps/web/src/lib/commands/timeline/clipboard/paste.ts
@@ -1,10 +1,7 @@
import { Command, type CommandResult } from "@/lib/commands/base-command";
import { EditorCore } from "@/core";
-import type {
- SceneTracks,
- TimelineElement,
- ClipboardItem,
-} from "@/lib/timeline";
+import type { SceneTracks, TimelineElement } from "@/lib/timeline";
+import type { ElementClipboardItem } from "@/lib/clipboard";
import { generateUUID } from "@/utils/id";
import { applyPlacement, resolveTrackPlacement, enforceMainTrackStart } from "@/lib/timeline/placement";
import { cloneAnimations } from "@/lib/animation";
@@ -13,14 +10,14 @@ export class PasteCommand extends Command {
private savedState: SceneTracks | null = null;
private pastedElements: { trackId: string; elementId: string }[] = [];
private readonly time: number;
- private readonly clipboardItems: ClipboardItem[];
+ private readonly clipboardItems: ElementClipboardItem[];
constructor({
time,
clipboardItems,
}: {
time: number;
- clipboardItems: ClipboardItem[];
+ clipboardItems: ElementClipboardItem[];
}) {
super();
this.time = time;
@@ -145,9 +142,9 @@ export class PasteCommand extends Command {
function groupClipboardItemsByTrackId({
clipboardItems,
}: {
- clipboardItems: ClipboardItem[];
-}): Map<string, ClipboardItem[]> {
- const groupedItems = new Map<string, ClipboardItem[]>();
+ clipboardItems: ElementClipboardItem[];
+}): Map<string, ElementClipboardItem[]> {
+ const groupedItems = new Map<string, ElementClipboardItem[]>();
for (const item of clipboardItems) {
const existingItems = groupedItems.get(item.trackId) ?? [];
@@ -162,7 +159,7 @@ function buildPastedElements({
minStart,
time,
}: {
- items: ClipboardItem[];
+ items: ElementClipboardItem[];
minStart: number;
time: number;
}): TimelineElement[] {