From 2272598d420cf078aaa3928246bfa3a414f6eddb Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Mon, 13 Apr 2026 04:40:56 +0200 Subject: feat: clipboard with keyframe paste Made-with: Cursor --- apps/web/src/lib/commands/timeline/clipboard/paste.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'apps/web/src/lib/commands/timeline/clipboard/paste.ts') 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 { - const groupedItems = new Map(); + clipboardItems: ElementClipboardItem[]; +}): Map { + const groupedItems = new Map(); 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[] { -- cgit v1.3.1