From f649e4698b749c62c6f3c413605fb77d874f2569 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 21 Dec 2024 02:52:05 +0200 Subject: [PATCH] Invert if cssAutofit --- public/scripts/RossAscends-mods.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 213f9f07e..5334019d4 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -916,16 +916,19 @@ export function initRossMods() { } sendTextArea.addEventListener('input', () => { - if (!cssAutofit) { - const hasContent = sendTextArea.value !== ''; - const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight; - const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth; - const isHalfScreenHeight = sendTextArea.offsetHeight >= window.innerHeight / 2; - const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight)); - if (needsDebounce) autoFitSendTextAreaDebounced(); - else autoFitSendTextArea(); - } saveUserInputDebounced(); + + if (cssAutofit) { + return; + } + + const hasContent = sendTextArea.value !== ''; + const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight; + const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth; + const isHalfScreenHeight = sendTextArea.offsetHeight >= window.innerHeight / 2; + const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight)); + if (needsDebounce) autoFitSendTextAreaDebounced(); + else autoFitSendTextArea(); }); restoreUserInput();