mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup shortcuts scope handling
This commit is contained in:
parent
874f2592ca
commit
60987f4623
5 changed files with 16 additions and 22 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import ko from 'ko';
|
||||
import { Scope } from 'Common/Enums';
|
||||
|
||||
let keyScopeFake = Scope.All;
|
||||
let keyScopeFake = 'all';
|
||||
|
||||
export const
|
||||
ScopeMenu = 'Menu',
|
||||
|
|
@ -43,21 +42,20 @@ export const
|
|||
addEventsListeners = (element, events) =>
|
||||
Object.entries(events).forEach(([event, fn]) => element.addEventListener(event, fn)),
|
||||
|
||||
// keys
|
||||
keyScopeReal = ko.observable(Scope.All),
|
||||
// keys / shortcuts
|
||||
keyScopeReal = ko.observable('all'),
|
||||
keyScope = value => {
|
||||
if (value) {
|
||||
if (ScopeMenu !== value) {
|
||||
keyScopeFake = value;
|
||||
if (dropdownVisibility()) {
|
||||
value = ScopeMenu;
|
||||
}
|
||||
}
|
||||
keyScopeReal(value);
|
||||
shortcuts.setScope(value);
|
||||
} else {
|
||||
if (!value) {
|
||||
return keyScopeFake;
|
||||
}
|
||||
if (ScopeMenu !== value) {
|
||||
keyScopeFake = value;
|
||||
if (dropdownVisibility()) {
|
||||
value = ScopeMenu;
|
||||
}
|
||||
}
|
||||
keyScopeReal(value);
|
||||
shortcuts.setScope(value);
|
||||
};
|
||||
|
||||
dropdownVisibility.subscribe(value => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue