Add rounding to textarea autofit

This commit is contained in:
Cohee
2024-05-13 16:48:35 +03:00
parent cc077732c4
commit 64500bfb37
2 changed files with 3 additions and 3 deletions

View File

@@ -702,7 +702,7 @@ 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 (sendTextArea.scrollHeight + 3 == sendTextArea.offsetHeight) { if (Math.ceil(sendTextArea.scrollHeight + 3) >= Math.floor(sendTextArea.offsetHeight)) {
// Needs to be pulled dynamically because it is affected by font size changes // Needs to be pulled dynamically because it is affected by font size changes
const sendTextAreaMinHeight = window.getComputedStyle(sendTextArea).getPropertyValue('min-height'); const sendTextAreaMinHeight = window.getComputedStyle(sendTextArea).getPropertyValue('min-height');
sendTextArea.style.height = sendTextAreaMinHeight; sendTextArea.style.height = sendTextAreaMinHeight;

View File

@@ -1112,8 +1112,8 @@ select {
} }
#send_textarea { #send_textarea {
min-height: calc(var(--bottomFormBlockSize) + 3px); min-height: calc(var(--bottomFormBlockSize) + 2px);
height: calc(var(--bottomFormBlockSize) + 3px); height: calc(var(--bottomFormBlockSize) + 2px);
max-height: 50vh; max-height: 50vh;
max-height: 50svh; max-height: 50svh;
word-wrap: break-word; word-wrap: break-word;