Skip to content

Commit 44697bb

Browse files
Code2Collapseclaude
andcommitted
feat(WanDirector): Ctrl+V clipboard-image paste (LTX parity) — port to main
Single-file port of the paste-parity fix from feat (self-contained addition, no new imports). Same file already on main from the prior UI port. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 771ea2c commit 44697bb

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

js/wan_director_timeline.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,10 @@ class TimelineEditor {
683683
e.preventDefault();
684684
}
685685
else if ((e.key === "v" || e.key === "V") && (e.ctrlKey || e.metaKey)) {
686-
if (this.clipboard) this._pasteAt(this.playhead, this.clipboard.track);
687-
e.preventDefault();
686+
// Segment paste only preventDefaults when there IS a copied clip —
687+
// otherwise let the browser 'paste' event fire so a clipboard
688+
// IMAGE can drop onto the Scene track (LTX-Director parity).
689+
if (this.clipboard) { this._pasteAt(this.playhead, this.clipboard.track); e.preventDefault(); }
688690
}
689691
else if (e.key === "d" || e.key === "D") {
690692
// Duplicate the selected clip right after itself.
@@ -721,6 +723,20 @@ class TimelineEditor {
721723
else if (e.key === "End") { this.playhead = this.durFrames; this.render(); e.preventDefault(); }
722724
});
723725

726+
// Ctrl+V of a clipboard IMAGE → add an image segment (LTX-Director
727+
// parity: LTX binds a document 'paste' handler). Scoped to the canvas
728+
// (tabIndex focusable), so it only fires when the timeline is focused.
729+
this.cvs.addEventListener("paste", (e) => {
730+
const items = e.clipboardData?.items || [];
731+
for (const it of items) {
732+
if (it.type && it.type.startsWith("image/")) {
733+
const file = it.getAsFile();
734+
if (file) { e.preventDefault(); this.addImageSegmentFromFile(file); }
735+
return;
736+
}
737+
}
738+
});
739+
724740
// Seek bar
725741
this.seek.oninput = () => {
726742
const v = parseInt(this.seek.value) / 10000;

0 commit comments

Comments
 (0)