mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Revert "Fix/autofix empty div (#2066)"
This reverts commit 892c9f6da8
.
Reverting until #2093 can be addressed
This commit is contained in:
parent
23e6b2123e
commit
eb5600019a
1 changed files with 5 additions and 9 deletions
|
@ -19,7 +19,7 @@ function adjustInputHTML(html: string): string {
|
||||||
|
|
||||||
function adjustInputFragment(fragment: DocumentFragment): void {
|
function adjustInputFragment(fragment: DocumentFragment): void {
|
||||||
if (nodeContainsInlineContent(fragment)) {
|
if (nodeContainsInlineContent(fragment)) {
|
||||||
fragment.append(document.createElement("br"));
|
fragment.appendChild(document.createElement("br"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,16 +35,12 @@ export function storedToFragment(storedHTML: string): DocumentFragment {
|
||||||
|
|
||||||
function adjustOutputFragment(fragment: DocumentFragment): void {
|
function adjustOutputFragment(fragment: DocumentFragment): void {
|
||||||
if (
|
if (
|
||||||
|
fragment.hasChildNodes() &&
|
||||||
|
nodeIsElement(fragment.lastChild!) &&
|
||||||
nodeContainsInlineContent(fragment) &&
|
nodeContainsInlineContent(fragment) &&
|
||||||
fragment.lastChild &&
|
fragment.lastChild!.tagName === "BR"
|
||||||
nodeIsElement(fragment.lastChild) &&
|
|
||||||
fragment.lastChild.tagName === "BR"
|
|
||||||
) {
|
) {
|
||||||
fragment.lastChild.remove();
|
fragment.lastChild!.remove();
|
||||||
}
|
|
||||||
|
|
||||||
for (const divElement of fragment.querySelectorAll("div:empty")) {
|
|
||||||
divElement.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue