mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-03 06:22:55 +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();
|
||||
});
|
||||
|
||||
new ResizeObserver(() => {
|
||||
this.inputElement.style.height = this.displayElement.scrollHeight + "px";
|
||||
this.inputElement.style.width = this.displayElement.scrollWidth + "px";
|
||||
}).observe(this.displayElement);
|
||||
|
||||
this.#updateReadonly();
|
||||
this.#sync();
|
||||
}
|
||||
|
|
@ -87,8 +92,6 @@ class EditableArea extends HTMLElement {
|
|||
|
||||
#sync() {
|
||||
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