mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-13 18:50:29 +03:00
Add typing outside focus on msg feild (#112)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
6d5d40b8e3
commit
5797a1d8e5
6 changed files with 23 additions and 40 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue