Skip to content

Commit

Permalink
Merge pull request #5 from marcreichel/fix/respect-rows
Browse files Browse the repository at this point in the history
🐛 Respect rows
  • Loading branch information
marcreichel committed Mar 16, 2022
2 parents 4abd450 + 34efd8c commit 9181517
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions dist/alpine-autosize.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine-autosize.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine-autosize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/alpine-autosize.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 9181517

Please sign in to comment.