| 9242 | const autoFitEditTextAreaDebounced = debounce(autoFitEditTextArea, debounce_timeout.short); | 9242 | const autoFitEditTextAreaDebounced = debounce(autoFitEditTextArea, debounce_timeout.short); |
| 9243 | document.addEventListener('input', e => { | 9243 | document.addEventListener('input', e => { |
| 9244 | if (e.target instanceof HTMLTextAreaElement && e.target.classList.contains('edit_textarea')) { | 9244 | if (e.target instanceof HTMLTextAreaElement && e.target.classList.contains('edit_textarea')) { |
| 9245 | const immediately = e.target.scrollHeight > e.target.offsetHeight || e.target.value === ''; | 9245 | const scrollbarShown = e.target.clientWidth < e.target.offsetWidth && e.target.offsetHeight >= window.innerHeight * 0.75; |
| | 9246 | const immediately = (e.target.scrollHeight > e.target.offsetHeight && !scrollbarShown) || e.target.value === ''; |
| 9246 | immediately ? autoFitEditTextArea(e.target) : autoFitEditTextAreaDebounced(e.target); | 9247 | immediately ? autoFitEditTextArea(e.target) : autoFitEditTextAreaDebounced(e.target); |
| 9247 | } | 9248 | } |
| 9248 | }); | 9249 | }); |