Fix EditBox expansion and handling of Tab key

This commit is contained in:
Bojan Mojsilovic 2023-09-11 13:57:01 +02:00
parent d050e9aa64
commit e95edadf62
2 changed files with 4 additions and 1 deletions

View File

@ -229,6 +229,7 @@ textarea::-webkit-scrollbar{
.editor {
max-width: calc(100% - 14px);
min-height: 60px;
max-height: 46vh;
outline: 0px solid transparent;
word-wrap: break-word;
font-size: 16px;

View File

@ -112,9 +112,11 @@ const EditBox: Component<{
if (elm.scrollHeight >= (maxHeight / 3)) {
elm.style.height = '46vh';
return;
}
elm.style.height = 'auto';
elm.rows = minRows;
const rows = Math.ceil((elm.scrollHeight - elm._baseScrollHeight) / 20);
elm.rows = minRows + rows;
@ -146,7 +148,7 @@ const EditBox: Component<{
return;
}
const mentionSeparators = ['Enter', 'Space', 'Comma'];
const mentionSeparators = ['Enter', 'Space', 'Comma', 'Tab'];
if (e.code === 'Enter' && e.metaKey) {
e.preventDefault();