mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-16 21:06:35 +08:00
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
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:
parent
bcecd22e24
commit
495006f8ab
@ -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
|
||||
);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user