Merge pull request #2517 from Succubyss/patch-3 sendTextArea: The same ... but prettier!

df86ec6a5dee00eaf1a7e17180abb46895533e97

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +8 -7Ignore whitespace
public/scripts/RossAscends-mods.js+8 -7
@@ -881,13 +881,14 @@ export function initRossMods() {
881 saveSettingsDebounced();881 saveSettingsDebounced();
882 });882 });
883883
884 $(sendTextArea).on('input', () => {884 sendTextArea.addEventListener('input', () => {
885 const scrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth && sendTextArea.offsetHeight >= window.innerHeight / 2;885 const hasContent = sendTextArea.value !== '';
886 if ((sendTextArea.scrollHeight > sendTextArea.offsetHeight && !scrollbarShown) || sendTextArea.value === '') {886 const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight;
887 autoFitSendTextArea();887 const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth;
888 } else {888 const isHalfScreenHeight = sendTextArea.offsetHeight >= window.innerHeight / 2;
889 autoFitSendTextAreaDebounced();889 const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight));
890 }890 if (needsDebounce) autoFitSendTextAreaDebounced();
891 else autoFitSendTextArea();
891 saveUserInputDebounced();892 saveUserInputDebounced();
892 });893 });
893894