mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Prevent insertion of breaks into empty fields
to allow :empty CSS selector to also work on fields other than the first one.
This commit is contained in:
parent
47d6cd3fac
commit
1615fd5cf4
1 changed files with 0 additions and 7 deletions
|
@ -17,19 +17,12 @@ function adjustInputHTML(html: string): string {
|
|||
return html;
|
||||
}
|
||||
|
||||
function adjustInputFragment(fragment: DocumentFragment): void {
|
||||
if (nodeContainsInlineContent(fragment)) {
|
||||
fragment.appendChild(document.createElement("br"));
|
||||
}
|
||||
}
|
||||
|
||||
export function storedToFragment(storedHTML: string): DocumentFragment {
|
||||
/* We need .createContextualFragment so that customElements are initialized */
|
||||
const fragment = document
|
||||
.createRange()
|
||||
.createContextualFragment(createDummyDoc(adjustInputHTML(storedHTML)));
|
||||
|
||||
adjustInputFragment(fragment);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue