Merge pull request #4088 from grafixeyehero/Fix-bug-textarea

This commit is contained in:
Bill Thornton 2022-10-22 10:50:43 -04:00 committed by GitHub
commit 8714ddf0b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,12 @@ import './emby-textarea.scss';
import 'webcomponents.js/webcomponents-lite';
import '../emby-input/emby-input';
/**
* Calculates the vertical padding of the element
* @param textarea
* @returns {number}
*/
function calculateOffset(textarea) {
const style = window.getComputedStyle(textarea, null);
const props = ['paddingTop', 'paddingBottom'];
@ -21,17 +27,10 @@ function calculateOffset(textarea) {
maxLines = 999;
}
/**
* Calculates the vertical padding of the element
* @param textarea
* @returns {number}
*/
self.getOffset = calculateOffset(textarea);
let offset;
function reset() {
textarea.rows = 1;
offset = self.getOffset(textarea);
offset = calculateOffset(textarea);
self.rows = textarea.rows || 1;
self.lineHeight = (textarea.scrollHeight / self.rows) - (offset / self.rows);
self.maxAllowedHeight = (self.lineHeight * maxLines) - offset;