Skip to content

feat(studio): add Ctrl+C/V/X copy/paste for timeline clips and DOM elements#891

Closed
miguel-heygen wants to merge 5 commits into
mainfrom
feat/studio-copy-paste-core
Closed

feat(studio): add Ctrl+C/V/X copy/paste for timeline clips and DOM elements#891
miguel-heygen wants to merge 5 commits into
mainfrom
feat/studio-copy-paste-core

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

Summary

  • Adds Ctrl+C / Ctrl+V / Ctrl+X keyboard shortcuts for copying, pasting, and cutting timeline clips and DOM elements
  • Contextual dispatch: timeline clip selected → clip operations; DOM element selected → element operations
  • Pasted timeline clips re-timed to playhead position with deduplicated IDs
  • DOM elements pasted as siblings (same parent context) preserving CSS inheritance
  • All operations fully undoable via Ctrl+Z
  • Cross-frame instanceof fix for iframe DOM access
  • isEditableTarget guard preserves native copy/paste in text inputs

Test plan

  • 5 unit tests for clipboard payload (dedup, serialization, round-trip)
  • Build passes, lint clean
  • Manual: copy/paste timeline clips, DOM elements, undo all work

Elements from the preview iframe are from a different window context,
so `el instanceof HTMLElement` always returns false. Use `"outerHTML"
in el` instead to correctly detect elements across frame boundaries.
reloadPreview() used location.reload() which bypassed the
NLELayout saveSeekPosition effect, causing the playhead to reset
to 0:00 after paste. Switch to setRefreshKey which triggers the
effect and restores the seek position after the iframe reloads.
DOM element paste was inserting at the composition root, losing the
parent context that provides CSS styles and positioning. Now stores
the origin selector on copy and inserts the paste as a sibling
immediately after the original element, preserving style inheritance.
Falls back to root insertion if the selector can't be matched.
@miguel-heygen
Copy link
Copy Markdown
Collaborator Author

Moving to Graphite stack

@miguel-heygen miguel-heygen deleted the feat/studio-copy-paste-core branch May 16, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant