From add940201ebe5903c540232210e8f79264ef3a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Tue, 24 Nov 2026 07:52:27 +0000 Subject: [PATCH] fix(studio): paste and duplicate no longer write the copy's HTML comments (#8657) --- .../src/hooks/useClipboard.sealed.test.ts | 11 +++++++++-- .../src/hooks/useClipboard.written.test.ts | 17 +++++++++++++++++ packages/studio/src/utils/clipboardMarkup.ts | 11 +++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/packages/studio/src/hooks/useClipboard.sealed.test.ts b/packages/studio/src/hooks/useClipboard.sealed.test.ts index 728aa00bc2..5a3396b34d 100644 --- a/packages/studio/src/hooks/useClipboard.sealed.test.ts +++ b/packages/studio/src/hooks/useClipboard.sealed.test.ts @@ -220,7 +220,8 @@ function handlersServed(written: string): string[] { ); } -// fails without the fix: a comment in an svg passed the check, and the server's parser serves it as markup. +// fails without the fix: a comment in an svg <title> passed the check, and the server's parser serves it as markup; +// then the live copy still wrote the comment. it("writes nothing the server serves as running code, from the live copy or a saved one", async () => { const svg = "<svg><title><!-- -->"; const live = sealedClipboard( @@ -229,7 +230,9 @@ it("writes nothing the server serves as running code, from the live copy or a sa ); expect(live.clipboard().handleCopy()).toBe(true); await live.clipboard().handlePaste(); + expect(live.writes.length).toBeGreaterThan(0); for (const file of live.writes) expect(handlersServed(file)).toEqual([]); + for (const file of live.writes) expect(file).not.toContain("', + '
', + ])("writes no comment from the copy %s", (html) => { + for (const readFrom of [null, "compositions/recv.html"]) { + const pasted = pasteElementHtml(FILE, { html, readFrom }, false, "index.html"); + const clip = { html, readFrom, start: 0, duration: 1, track: 1 }; + const placed = pasteTimelineClips(FILE, [clip], 0, [], false, "index.html").content; + for (const file of [pasted, placed]) { + expect(file).not.toContain("