fix(client): add doctype to preview iframe (#57041)
Some checks failed
CI - E2E - 3rd party donation tests / Build & Test (20.x) (push) Has been cancelled
CI - Node.js / Lint (20.x) (push) Has been cancelled
CI - Node.js / Build (20.x) (push) Has been cancelled
CI - Node.js / Test (20.x) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (20.x) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 20.x) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 20.x) (push) Has been cancelled

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Lasse Jørgensen 2024-11-07 23:28:44 +01:00 committed by GitHub
parent bcecd22e24
commit 495006f8ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -378,8 +378,11 @@ function writeToFrame(content: string, frame?: FrameDocument) {
}
const writeContentToFrame = (frameContext: Context) => {
const doctype =
frameContext.sources.contents?.match(/^<!DOCTYPE html>/i)?.[0] || '';
writeToFrame(
createHeader(frameContext.element.id) + frameContext.build,
doctype + createHeader(frameContext.element.id) + frameContext.build,
frameContext.document
);