Skip to content

Commit

Permalink
🐛 Respect rows
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
marcreichel committed Mar 16, 2022
1 parent 4abd450 commit a6d79f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ function Autosize(Alpine) {
const previousResizeValue = el.style.resize;
el.style.resize = 'none';

const previousMinHeight = el.style.minHeight;
el.style.minHeight = el.getBoundingClientRect().height + 'px';

const handler = (event) => {
const element = event.target;
element.style.height = '4px';
Expand All @@ -15,6 +18,7 @@ function Autosize(Alpine) {

cleanup(() => {
el.style.resize = previousResizeValue;
el.style.minHeight = previousMinHeight;
el.removeEventListener('input', handler);
});
});
Expand Down

0 comments on commit a6d79f3

Please sign in to comment.