Remove getComputedStyle calls
This commit is contained in:
parent
a57d994913
commit
684ce999f3
|
@ -9234,12 +9234,10 @@ jQuery(async function () {
|
|||
* @param {HTMLTextAreaElement} e Textarea element to auto-fit
|
||||
*/
|
||||
function autoFitEditTextArea(e) {
|
||||
const computedStyle = window.getComputedStyle(e);
|
||||
const maxHeight = parseInt(computedStyle.maxHeight, 10);
|
||||
scroll_holder = chatElement[0].scrollTop;
|
||||
e.style.height = computedStyle.minHeight;
|
||||
e.style.height = '0px';
|
||||
const newHeight = e.scrollHeight + 4;
|
||||
e.style.height = (newHeight < maxHeight) ? `${newHeight}px` : `${maxHeight}px`;
|
||||
e.style.height = `${newHeight}px`;
|
||||
is_use_scroll_holder = true;
|
||||
}
|
||||
const autoFitEditTextAreaDebounced = debouncedThrottle(autoFitEditTextArea, debounce_timeout.short);
|
||||
|
|
|
@ -694,16 +694,13 @@ const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|||
* this makes the chat input text area resize vertically to match the text size (limited by CSS at 50% window height)
|
||||
*/
|
||||
function autoFitSendTextArea() {
|
||||
// Needs to be pulled dynamically because it is affected by font size changes
|
||||
const computedStyle = window.getComputedStyle(sendTextArea);
|
||||
const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight);
|
||||
if (Math.ceil(sendTextArea.scrollHeight + 3) >= Math.floor(sendTextArea.offsetHeight)) {
|
||||
const sendTextAreaMinHeight = computedStyle.minHeight;
|
||||
const sendTextAreaMinHeight = '0px';
|
||||
sendTextArea.style.height = sendTextAreaMinHeight;
|
||||
}
|
||||
const maxHeight = parseInt(computedStyle.maxHeight, 10);
|
||||
const newHeight = sendTextArea.scrollHeight + 3;
|
||||
sendTextArea.style.height = (newHeight < maxHeight) ? `${newHeight}px` : `${maxHeight}px`;
|
||||
sendTextArea.style.height = `${newHeight}px`;
|
||||
|
||||
if (!isFirefox) {
|
||||
const newScrollTop = Math.round(chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom));
|
||||
|
|
Loading…
Reference in New Issue