mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-08 17:06:42 +00:00
dynamic edit height
This commit is contained in:
@@ -267,6 +267,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.#_edit.addEventListener("input", () => {
|
||||||
|
this.updateEditHeight();
|
||||||
|
});
|
||||||
|
|
||||||
// message tool
|
// message tool
|
||||||
this.#_tool = make("div", "tool");
|
this.#_tool = make("div", "tool");
|
||||||
|
|
||||||
@@ -797,6 +801,11 @@
|
|||||||
this.toggleEdit();
|
this.toggleEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateEditHeight() {
|
||||||
|
this.#_edit.style.height = "";
|
||||||
|
this.#_edit.style.height = `${Math.max(100, this.#_edit.scrollHeight + 2)}px`;
|
||||||
|
}
|
||||||
|
|
||||||
toggleEdit() {
|
toggleEdit() {
|
||||||
this.#editing = !this.#editing;
|
this.#editing = !this.#editing;
|
||||||
|
|
||||||
@@ -804,11 +813,10 @@
|
|||||||
activeMessage = this;
|
activeMessage = this;
|
||||||
|
|
||||||
this.#_edit.value = this.#text;
|
this.#_edit.value = this.#text;
|
||||||
this.#_edit.style.height = "";
|
|
||||||
|
|
||||||
this.setState("editing");
|
this.setState("editing");
|
||||||
|
|
||||||
this.#_edit.style.height = `${Math.max(100, this.#_edit.scrollHeight)}px`;
|
this.updateEditHeight();
|
||||||
|
|
||||||
this.#_edit.focus();
|
this.#_edit.focus();
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user