mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-25 08:32:45 +00:00
fix(core): a colour-graded video no longer adds a stray row to the Studio timeline (#8776)
This commit is contained in:
@@ -370,6 +370,47 @@ describe("initSandboxRuntimeModular", () => {
|
||||
expect(caption.getAttribute("data-start")).toBe("0");
|
||||
});
|
||||
|
||||
it("does not stamp timing onto an element the runtime marks as its own", () => {
|
||||
const root = document.createElement("div");
|
||||
root.setAttribute("data-composition-id", "main");
|
||||
root.setAttribute("data-root", "true");
|
||||
root.setAttribute("data-start", "0");
|
||||
root.setAttribute("data-duration", "10");
|
||||
root.setAttribute("data-width", "1920");
|
||||
root.setAttribute("data-height", "1080");
|
||||
document.body.appendChild(root);
|
||||
|
||||
const gradingCanvas = document.createElement("canvas");
|
||||
gradingCanvas.id = "__hf_color_grading_clip";
|
||||
gradingCanvas.setAttribute("data-hf-ignore", "");
|
||||
root.appendChild(gradingCanvas);
|
||||
const helperHost = document.createElement("div");
|
||||
helperHost.setAttribute("data-hyperframes-ignore", "");
|
||||
const helperChild = document.createElement("div");
|
||||
helperChild.id = "helper-child";
|
||||
helperHost.appendChild(helperChild);
|
||||
root.appendChild(helperHost);
|
||||
const caption = document.createElement("div");
|
||||
caption.id = "cap-1";
|
||||
root.appendChild(caption);
|
||||
|
||||
const main = createMockTimeline(10);
|
||||
const tweenOnHelper = { ...mockTween(0, 10), targets: () => [helperChild] };
|
||||
main.getChildren = () => [tweenOnHelper as unknown as RuntimeTimelineLike];
|
||||
window.__timelines = { main };
|
||||
const realParent = window.parent;
|
||||
Object.defineProperty(window, "parent", { value: {}, configurable: true });
|
||||
try {
|
||||
initSandboxRuntimeModular();
|
||||
} finally {
|
||||
Object.defineProperty(window, "parent", { value: realParent, configurable: true });
|
||||
}
|
||||
|
||||
expect(gradingCanvas.hasAttribute("data-start")).toBe(false);
|
||||
expect(helperChild.hasAttribute("data-start")).toBe(false);
|
||||
expect(caption.getAttribute("data-start")).toBe("0");
|
||||
});
|
||||
|
||||
describe("visibility of runtime-stamped elements in Studio preview", () => {
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
|
||||
@@ -2343,6 +2343,8 @@ export function initSandboxRuntimeModular(): void {
|
||||
// group's automation lanes and FX rack with it.
|
||||
const isAudioGroupBus = (el: Element): boolean =>
|
||||
el.tagName.toLowerCase() === HF_AUDIO_GROUP_TAG;
|
||||
const isRuntimeOwned = (el: Element): boolean =>
|
||||
el.closest("[data-hf-ignore], [data-hyperframes-ignore]") !== null;
|
||||
const authoredTimed = new Set<Element>(document.querySelectorAll("[data-start]"));
|
||||
const hasAuthoredTimedAncestor = (element: HTMLElement): boolean => {
|
||||
let node = element.parentElement;
|
||||
@@ -2362,6 +2364,7 @@ export function initSandboxRuntimeModular(): void {
|
||||
if (!isHtmlElement(target)) continue;
|
||||
if (target === rootComp) continue;
|
||||
if (isAudioGroupBus(target)) continue;
|
||||
if (isRuntimeOwned(target)) continue;
|
||||
if (target.hasAttribute("data-start")) continue;
|
||||
if (hasAuthoredTimedAncestor(target)) continue;
|
||||
if (seen.has(target)) continue;
|
||||
@@ -2390,6 +2393,7 @@ export function initSandboxRuntimeModular(): void {
|
||||
if (seen.has(el)) continue;
|
||||
if (el.tagName === "SCRIPT" || el.tagName === "STYLE" || el.tagName === "LINK") continue;
|
||||
if (isAudioGroupBus(el)) continue;
|
||||
if (isRuntimeOwned(el)) continue;
|
||||
seen.add(el);
|
||||
el.setAttribute("data-start", "0");
|
||||
el.setAttribute("data-duration", dur);
|
||||
|
||||
Reference in New Issue
Block a user