From c92adb32d30b7b5aec6a60bb8bb0b319dd0902df Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sat, 31 Oct 2020 13:35:59 +0100 Subject: [PATCH] Fix height of textarea to multiple of 24px --- list-editor/textarea.autosize.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/list-editor/textarea.autosize.js b/list-editor/textarea.autosize.js index aa8d886..3595d95 100644 --- a/list-editor/textarea.autosize.js +++ b/list-editor/textarea.autosize.js @@ -21,7 +21,9 @@ function textareaAutosizeIinit($) { parseInt(this.$element.css('borderBottomWidth')) || 0; if (containsText(this.element.value)) { - this.$element.height(this.element.scrollHeight - diff); + let height = this.element.scrollHeight - diff; + height = 24 * Math.round(height / 24) + this.$element.height(height); } // keyup is required for IE to properly reset height when deleting text @@ -29,9 +31,11 @@ function textareaAutosizeIinit($) { var $window = $(window); var currentScrollPosition = $window.scrollTop(); + let height = this.scrollHeight - diff; + height = 24 * Math.round(height / 24) $(this) .height(0) - .height(this.scrollHeight - diff); + .height(height); $window.scrollTop(currentScrollPosition); });