mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Invert if cssAutofit
This commit is contained in:
@@ -916,16 +916,19 @@ export function initRossMods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendTextArea.addEventListener('input', () => {
|
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();
|
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();
|
restoreUserInput();
|
||||||
|
Reference in New Issue
Block a user