mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-03 14:32:54 +00:00
Handle editable-area display resize better
This commit is contained in:
parent
e24bc938c1
commit
23a1929ddd
1 changed files with 5 additions and 2 deletions
|
|
@ -23,6 +23,11 @@ class EditableArea extends HTMLElement {
|
||||||
this.#sync();
|
this.#sync();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
new ResizeObserver(() => {
|
||||||
|
this.inputElement.style.height = this.displayElement.scrollHeight + "px";
|
||||||
|
this.inputElement.style.width = this.displayElement.scrollWidth + "px";
|
||||||
|
}).observe(this.displayElement);
|
||||||
|
|
||||||
this.#updateReadonly();
|
this.#updateReadonly();
|
||||||
this.#sync();
|
this.#sync();
|
||||||
}
|
}
|
||||||
|
|
@ -87,8 +92,6 @@ class EditableArea extends HTMLElement {
|
||||||
|
|
||||||
#sync() {
|
#sync() {
|
||||||
this.displayElement.replaceChildren(...renderText(this.inputElement.value));
|
this.displayElement.replaceChildren(...renderText(this.inputElement.value));
|
||||||
this.inputElement.style.height = this.displayElement.scrollHeight + "px";
|
|
||||||
this.inputElement.style.width = this.displayElement.scrollWidth + "px";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue