diff --git a/ts/editor/plain-text-input/PlainTextInput.svelte b/ts/editor/plain-text-input/PlainTextInput.svelte index 3dfea8bd9..0d9fbee9d 100644 --- a/ts/editor/plain-text-input/PlainTextInput.svelte +++ b/ts/editor/plain-text-input/PlainTextInput.svelte @@ -55,11 +55,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } } - function parseAsHTML(html: string): string { - const doc = parser.parseFromString( - parsingInstructions.join("") + html, - "text/html", + function createDummyDoc(html: string): string { + return ( + "" + + parsingInstructions.join("") + + html + + "" ); + } + + function parseAsHTML(html: string): string { + const doc = parser.parseFromString(createDummyDoc(html), "text/html"); const body = doc.body; removeTag(body, "script");