fix: propagate data-timeline-locked in compiler inliners

The runtime path (compositionLoader.ts) already propagated
data-timeline-locked from inner root to host, but both compiler
inliners (bundler + producer) did not. Bundled output re-opened in
Studio would lose the lock. Now propagated in inlineSubCompositions
alongside the existing data-hf-authored-id propagation.
This commit is contained in:
Miguel Ángel
2026-05-20 02:40:49 -04:00
parent 9c159ad96d
commit 3e17ef7447
2 changed files with 23 additions and 0 deletions
@@ -197,6 +197,25 @@ describe("inlineSubCompositions #ID selector scoping divergence", () => {
); );
}); });
it("propagates data-timeline-locked from inner root to host element", () => {
const lockedSubComp = `<!doctype html>
<html><head></head><body>
<div id="captions" data-composition-id="captions" data-timeline-locked data-width="1920" data-height="1080">
<span>Hello</span>
</div>
</body></html>`;
const document = makeHostDocument("captions");
const host = document.querySelector('[data-composition-src="intro.html"]')!;
inlineSubCompositions(document, [host], {
resolveHtml: () => lockedSubComp,
parseHtml: (html) => parseHTML(html).document,
});
expect(host.hasAttribute("data-timeline-locked")).toBe(true);
});
it("producer path propagates data-hf-authored-id to host when inner root has id", () => { it("producer path propagates data-hf-authored-id to host when inner root has id", () => {
const document = makeHostDocument("intro"); const document = makeHostDocument("intro");
const host = document.querySelector('[data-composition-src="intro.html"]')!; const host = document.querySelector('[data-composition-src="intro.html"]')!;
@@ -302,6 +302,10 @@ export function inlineSubCompositions(
); );
} }
if (innerRoot?.hasAttribute("data-timeline-locked")) {
hostEl.setAttribute("data-timeline-locked", "");
}
// Copy dimension attributes from inner root to host if missing // Copy dimension attributes from inner root to host if missing
if (innerRoot) { if (innerRoot) {
const innerW = innerRoot.getAttribute("data-width"); const innerW = innerRoot.getAttribute("data-width");