fix self.getOffset is not a function
This commit is contained in:
parent
170532dc3c
commit
348125140b
1 changed files with 7 additions and 8 deletions
|
@ -2,6 +2,12 @@ import './emby-textarea.scss';
|
||||||
import 'webcomponents.js/webcomponents-lite';
|
import 'webcomponents.js/webcomponents-lite';
|
||||||
import '../emby-input/emby-input';
|
import '../emby-input/emby-input';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the vertical padding of the element
|
||||||
|
* @param textarea
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
|
||||||
function calculateOffset(textarea) {
|
function calculateOffset(textarea) {
|
||||||
const style = window.getComputedStyle(textarea, null);
|
const style = window.getComputedStyle(textarea, null);
|
||||||
const props = ['paddingTop', 'paddingBottom'];
|
const props = ['paddingTop', 'paddingBottom'];
|
||||||
|
@ -21,17 +27,10 @@ function calculateOffset(textarea) {
|
||||||
maxLines = 999;
|
maxLines = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculates the vertical padding of the element
|
|
||||||
* @param textarea
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
self.getOffset = calculateOffset(textarea);
|
|
||||||
|
|
||||||
let offset;
|
let offset;
|
||||||
function reset() {
|
function reset() {
|
||||||
textarea.rows = 1;
|
textarea.rows = 1;
|
||||||
offset = self.getOffset(textarea);
|
offset = calculateOffset(textarea);
|
||||||
self.rows = textarea.rows || 1;
|
self.rows = textarea.rows || 1;
|
||||||
self.lineHeight = (textarea.scrollHeight / self.rows) - (offset / self.rows);
|
self.lineHeight = (textarea.scrollHeight / self.rows) - (offset / self.rows);
|
||||||
self.maxAllowedHeight = (self.lineHeight * maxLines) - offset;
|
self.maxAllowedHeight = (self.lineHeight * maxLines) - offset;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue