Merge pull request #3006 from joenunezb/fix-textarea-width-bug
Fix: Inconsistent Textarea resizing in small width windows
This commit is contained in:
commit
7aad053e70
|
@ -703,16 +703,13 @@ const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||||
*/
|
*/
|
||||||
function autoFitSendTextArea() {
|
function autoFitSendTextArea() {
|
||||||
const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight);
|
const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight);
|
||||||
if (Math.ceil(sendTextArea.scrollHeight + 3) >= Math.floor(sendTextArea.offsetHeight)) {
|
|
||||||
const sendTextAreaMinHeight = '0px';
|
sendTextArea.style.height = '1px'; // Reset height to 1px to force recalculation of scrollHeight
|
||||||
sendTextArea.style.height = sendTextAreaMinHeight;
|
const newHeight = sendTextArea.scrollHeight;
|
||||||
}
|
|
||||||
const newHeight = sendTextArea.scrollHeight + 3;
|
|
||||||
sendTextArea.style.height = `${newHeight}px`;
|
sendTextArea.style.height = `${newHeight}px`;
|
||||||
|
|
||||||
if (!isFirefox) {
|
if (!isFirefox) {
|
||||||
const newScrollTop = Math.round(chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom));
|
chatBlock.scrollTop = chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom);
|
||||||
chatBlock.scrollTop = newScrollTop;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short);
|
export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short);
|
||||||
|
|
Loading…
Reference in New Issue