Reorder methods / properties
This commit is contained in:
parent
e37fd2e091
commit
2e72de4af0
@ -424,10 +424,6 @@ function onCutOrCopy(): boolean {
|
||||
}
|
||||
|
||||
class EditingArea extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this.setAttribute("contenteditable", "");
|
||||
}
|
||||
|
||||
set fieldHTML(content: string) {
|
||||
this.innerHTML = content;
|
||||
|
||||
@ -441,6 +437,10 @@ class EditingArea extends HTMLElement {
|
||||
? this.innerHTML.slice(0, -4) // trim trailing <br>
|
||||
: this.innerHTML;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.setAttribute("contenteditable", "");
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("editing-area", EditingArea);
|
||||
@ -471,6 +471,14 @@ class EditingContainer extends HTMLDivElement {
|
||||
return Number(this.getAttribute("ord"));
|
||||
}
|
||||
|
||||
set fieldHTML(content: string) {
|
||||
this.editingArea.fieldHTML = content;
|
||||
}
|
||||
|
||||
get fieldHTML(): string {
|
||||
return this.editingArea.fieldHTML;
|
||||
}
|
||||
|
||||
connectedCallback(): void {
|
||||
this.addEventListener("keydown", onKey);
|
||||
this.addEventListener("keyup", onKeyUp);
|
||||
@ -530,14 +538,6 @@ class EditingContainer extends HTMLDivElement {
|
||||
blurEditingArea(): void {
|
||||
this.editingArea.blur();
|
||||
}
|
||||
|
||||
set fieldHTML(content: string) {
|
||||
this.editingArea.fieldHTML = content;
|
||||
}
|
||||
|
||||
get fieldHTML(): string {
|
||||
return this.editingArea.fieldHTML;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("editing-container", EditingContainer, { extends: "div" });
|
||||
@ -567,6 +567,10 @@ class EditorField extends HTMLDivElement {
|
||||
return ["ord"];
|
||||
}
|
||||
|
||||
set ord(n: number) {
|
||||
this.setAttribute("ord", String(n));
|
||||
}
|
||||
|
||||
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void {
|
||||
switch (name) {
|
||||
case "ord":
|
||||
@ -574,10 +578,6 @@ class EditorField extends HTMLDivElement {
|
||||
}
|
||||
}
|
||||
|
||||
set ord(n: number) {
|
||||
this.setAttribute("ord", String(n));
|
||||
}
|
||||
|
||||
initialize(label: string, color: string, content: string): void {
|
||||
this.label.innerText = label;
|
||||
this.editingContainer.initialize(color, content);
|
||||
|
Loading…
Reference in New Issue
Block a user