Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(studio): keep composition multi-drag positions in sync (#2629)
Miguel Ángelf7911d10b0a7
diff --git a/packages/studio/src/hooks/timelineEditingHelpers.test.ts b/packages/studio/src/hooks/timelineEditingHelpers.test.tsindex 98c263f2ad..5ac3b69204 100644--- a/packages/studio/src/hooks/timelineEditingHelpers.test.ts+++ b/packages/studio/src/hooks/timelineEditingHelpers.test.ts@@ -142,6 +142,32 @@ describe("applyTimelineStackingReorder", () => {});describe("patchIframeDomTiming", () => {+ it("patches a top-level composition host in its parent source file", () => {+ const iframe = makeIframeWith(`+ <div data-composition-id="root">+ <div+ id="scene-host"+ data-composition-id="scene"+ data-composition-src="compositions/scene.html"+ data-start="2"+ ></div>+ </div>+ `);+ const host = iframe.contentDocument?.getElementById("scene-host");+ const target = el({+ id: "scene-host",+ tag: "div",+ kind: "composition",+ domId: "scene-host",+ sourceFile: "index.html",+ compositionSrc: "compositions/scene.html",+ });++ patchIframeDomTiming(iframe, target, [["data-start", "9"]], "index.html");++ expect(host?.getAttribute("data-start")).toBe("9");+ });+it("resolves selectorIndex within the element's source file", () => {const iframe = makeIframeWith(`<div data-composition-id="root">diff --git a/packages/studio/src/hooks/timelineEditingHelpers.ts b/packages/studio/src/hooks/timelineEditingHelpers.tsindex 7d0ecc7cf8..ffa4d2fd60 100644--- a/packages/studio/src/hooks/timelineEditingHelpers.ts+++ b/packages/studio/src/hooks/timelineEditingHelpers.ts@@ -13,7 +13,10 @@ import { saveProjectFilesWithHistory, type RecordEditInput } from "../utils/studimport type { TimelineZIndexReorderCommit } from "./useTimelineEditingTypes";import { setCompositionDurationToContent } from "../utils/timelineAssetDrop";import { readFileContent } from "./timelineTimingSync";-import { findElementForSelection } from "../components/editor/domEditingElement";+import {+ findElementForSelection,+ findElementForTimelineElement,+} from "../components/editor/domEditingElement";export { deleteSelectedKeyframes } from "./deleteSelectedKeyframes";export { readFileContent };function isHTMLElement(element: Element | null): element is HTMLElement {@@ -137,6 +140,12 @@ export function findTimelineElementInIframe(try {const doc = iframe?.contentDocument;if (!doc) return null;+ if (element.kind === "composition" && element.compositionSrc) {+ return findElementForTimelineElement(doc, element, {+ activeCompositionPath,+ isMasterView: true,+ });+ }return findElementForSelection(doc,{