From a6d79f3dcf957f794fc721495988524fe14b3a82 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Wed, 16 Mar 2022 07:56:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Respect=20rows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4 --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 03c5a5f..263abeb 100644 --- a/src/index.js +++ b/src/index.js @@ -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'; @@ -15,6 +18,7 @@ function Autosize(Alpine) { cleanup(() => { el.style.resize = previousResizeValue; + el.style.minHeight = previousMinHeight; el.removeEventListener('input', handler); }); });