mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
Make sure initial comments are preserved in HTML editor (#1647)
This commit is contained in:
parent
9a80524560
commit
16e9e56ad8
1 changed files with 10 additions and 4 deletions
|
@ -55,11 +55,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseAsHTML(html: string): string {
|
function createDummyDoc(html: string): string {
|
||||||
const doc = parser.parseFromString(
|
return (
|
||||||
parsingInstructions.join("") + html,
|
"<html><head></head><body>" +
|
||||||
"text/html",
|
parsingInstructions.join("") +
|
||||||
|
html +
|
||||||
|
"</body>"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseAsHTML(html: string): string {
|
||||||
|
const doc = parser.parseFromString(createDummyDoc(html), "text/html");
|
||||||
const body = doc.body;
|
const body = doc.body;
|
||||||
|
|
||||||
removeTag(body, "script");
|
removeTag(body, "script");
|
||||||
|
|
Loading…
Reference in a new issue