Invert if cssAutofit

This commit is contained in:
Cohee
2024-12-21 02:52:05 +02:00
parent d27d750cb2
commit f649e4698b

View File

@@ -916,7 +916,12 @@ export function initRossMods() {
} }
sendTextArea.addEventListener('input', () => { sendTextArea.addEventListener('input', () => {
if (!cssAutofit) { saveUserInputDebounced();
if (cssAutofit) {
return;
}
const hasContent = sendTextArea.value !== ''; const hasContent = sendTextArea.value !== '';
const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight; const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight;
const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth; const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth;
@@ -924,8 +929,6 @@ export function initRossMods() {
const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight)); const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight));
if (needsDebounce) autoFitSendTextAreaDebounced(); if (needsDebounce) autoFitSendTextAreaDebounced();
else autoFitSendTextArea(); else autoFitSendTextArea();
}
saveUserInputDebounced();
}); });
restoreUserInput(); restoreUserInput();