mirror of
https://github.com/thelounge/thelounge
synced 2025-02-25 11:47:08 +00:00
Merge pull request #504 from thelounge/astorije/fix-reset-textarea-height
Use min-height of textarea when computing auto-resize after deleting a char
This commit is contained in:
commit
b5e8ee6d7d
2 changed files with 6 additions and 2 deletions
|
@ -1263,6 +1263,7 @@ button {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
|
min-height: 18px; /* Required when computing input height at char deletion */
|
||||||
height: 18px;
|
height: 18px;
|
||||||
max-height: 90px;
|
max-height: 90px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|
|
@ -632,8 +632,11 @@ $(function() {
|
||||||
.history()
|
.history()
|
||||||
.on("input keyup", function() {
|
.on("input keyup", function() {
|
||||||
var style = window.getComputedStyle(this);
|
var style = window.getComputedStyle(this);
|
||||||
this.style.height = "0px";
|
|
||||||
this.offsetHeight; // force reflow
|
// Start by resetting height before computing as scrollHeight does not
|
||||||
|
// decrease when deleting characters
|
||||||
|
this.style.height = this.style.minHeight;
|
||||||
|
|
||||||
this.style.height = Math.min(
|
this.style.height = Math.min(
|
||||||
Math.round(window.innerHeight - 100), // prevent overflow
|
Math.round(window.innerHeight - 100), // prevent overflow
|
||||||
this.scrollHeight
|
this.scrollHeight
|
||||||
|
|
Loading…
Add table
Reference in a new issue