mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-13 18:50:29 +03:00
Add btn and hotkey to close room settings (#269)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
f310196937
commit
0c32d5302c
4 changed files with 58 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { openSearch } from '../action/navigation';
|
||||
import { openSearch, toggleRoomSettings } from '../action/navigation';
|
||||
import navigation from '../state/navigation';
|
||||
|
||||
function listenKeyboard(event) {
|
||||
|
|
@ -17,11 +17,19 @@ function listenKeyboard(event) {
|
|||
if (['text', 'textarea'].includes(document.activeElement.type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// esc - close room settings panel
|
||||
if (event.keyCode === 27 && navigation.isRoomSettings) {
|
||||
toggleRoomSettings();
|
||||
}
|
||||
|
||||
if ((event.keyCode !== 8 && event.keyCode < 48)
|
||||
|| (event.keyCode >= 91 && event.keyCode <= 93)
|
||||
|| (event.keyCode >= 112 && event.keyCode <= 183)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// press any key to focus and type in message field
|
||||
const msgTextarea = document.getElementById('message-textarea');
|
||||
msgTextarea?.focus();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue