mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14: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 {
|
||||
const doc = parser.parseFromString(
|
||||
parsingInstructions.join("") + html,
|
||||
"text/html",
|
||||
function createDummyDoc(html: string): string {
|
||||
return (
|
||||
"<html><head></head><body>" +
|
||||
parsingInstructions.join("") +
|
||||
html +
|
||||
"</body>"
|
||||
);
|
||||
}
|
||||
|
||||
function parseAsHTML(html: string): string {
|
||||
const doc = parser.parseFromString(createDummyDoc(html), "text/html");
|
||||
const body = doc.body;
|
||||
|
||||
removeTag(body, "script");
|
||||
|
|
Loading…
Reference in a new issue