Rename fieldContainsInlineContent to containsInlineContent to reflect new usage
This commit is contained in:
parent
7dc4b8818c
commit
e0d1450ce0
@ -334,7 +334,7 @@ function onBlur(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fieldContainsInlineContent(field: Element): boolean {
|
function containsInlineContent(field: Element): boolean {
|
||||||
if (field.childNodes.length === 0) {
|
if (field.childNodes.length === 0) {
|
||||||
// for now, for all practical purposes, empty fields are in block mode
|
// for now, for all practical purposes, empty fields are in block mode
|
||||||
return false;
|
return false;
|
||||||
@ -444,13 +444,13 @@ class EditingArea extends HTMLElement {
|
|||||||
set fieldHTML(content: string) {
|
set fieldHTML(content: string) {
|
||||||
this.innerHTML = content;
|
this.innerHTML = content;
|
||||||
|
|
||||||
if (fieldContainsInlineContent(this)) {
|
if (containsInlineContent(this)) {
|
||||||
this.appendChild(document.createElement("br"));
|
this.appendChild(document.createElement("br"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get fieldHTML(): string {
|
get fieldHTML(): string {
|
||||||
return fieldContainsInlineContent(this) && this.innerHTML.endsWith("<br>")
|
return containsInlineContent(this) && this.innerHTML.endsWith("<br>")
|
||||||
? this.innerHTML.slice(0, -4) // trim trailing <br>
|
? this.innerHTML.slice(0, -4) // trim trailing <br>
|
||||||
: this.innerHTML;
|
: this.innerHTML;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user