Add typing outside focus on msg feild (#112)

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-12-13 14:31:43 +05:30
parent 6d5d40b8e3
commit 5797a1d8e5
6 changed files with 23 additions and 40 deletions

View file

@ -6,11 +6,24 @@ function listenKeyboard(event) {
if (event.ctrlKey) {
// k - for search Modal
if (event.keyCode === 75) {
if (navigation.isRawModalVisible) return;
event.preventDefault();
if (navigation.isRawModalVisible) return;
openSearch();
}
}
if (!event.ctrlKey && !event.altKey) {
if (navigation.isRawModalVisible) return;
if (['input', 'textarea'].includes(document.activeElement.type)) {
return;
}
if (event.keyCode < 48
|| (event.keyCode >= 91 && event.keyCode <= 93)
|| (event.keyCode >= 112 && event.keyCode <= 183)) {
return;
}
const msgTextarea = document.getElementById('message-textarea');
msgTextarea?.focus();
}
}
function initHotkeys() {