mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Small code cleanups and fix translations
This commit is contained in:
parent
b31bf3d7f5
commit
7ccc44616d
54 changed files with 288 additions and 426 deletions
|
|
@ -1,47 +1,55 @@
|
|||
import ko from 'ko';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
|
||||
export const $html = document.documentElement;
|
||||
export const $htmlCL = $html.classList;
|
||||
export const doc = document;
|
||||
|
||||
export const $htmlCL = doc.documentElement.classList;
|
||||
|
||||
export const Settings = rl.settings;
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||
|
||||
export const moveAction = ko.observable(false);
|
||||
export const leftPanelDisabled = ko.observable(false);
|
||||
export const leftPanelType = ko.observable('');
|
||||
export const leftPanelWidth = ko.observable(0);
|
||||
|
||||
leftPanelDisabled.subscribe(value => value && moveAction() && moveAction(false));
|
||||
leftPanelDisabled.subscribe(value => {
|
||||
value && moveAction() && moveAction(false);
|
||||
$htmlCL.toggle('rl-left-panel-disabled', value);
|
||||
});
|
||||
|
||||
leftPanelType.subscribe(sValue => {
|
||||
$htmlCL.toggle('rl-left-panel-none', 'none' === sValue);
|
||||
$htmlCL.toggle('rl-left-panel-short', 'short' === sValue);
|
||||
});
|
||||
|
||||
moveAction.subscribe(value => value && leftPanelDisabled() && leftPanelDisabled(false));
|
||||
|
||||
// keys
|
||||
export const keyScopeReal = ko.observable(KeyState.All);
|
||||
export const keyScopeFake = ko.observable(KeyState.All);
|
||||
|
||||
export const keyScope = ko.computed({
|
||||
read: () => keyScopeFake(),
|
||||
write: value => {
|
||||
if (KeyState.Menu !== value) {
|
||||
keyScopeFake(value);
|
||||
if (dropdownVisibility()) {
|
||||
value = KeyState.Menu;
|
||||
}
|
||||
export const keyScope = (()=>{
|
||||
let keyScopeFake = KeyState.All;
|
||||
dropdownVisibility.subscribe(value => {
|
||||
if (value) {
|
||||
keyScope(KeyState.Menu);
|
||||
} else if (KeyState.Menu === shortcuts.getScope()) {
|
||||
keyScope(keyScopeFake);
|
||||
}
|
||||
});
|
||||
return ko.computed({
|
||||
read: () => keyScopeFake,
|
||||
write: value => {
|
||||
if (KeyState.Menu !== value) {
|
||||
keyScopeFake = value;
|
||||
if (dropdownVisibility()) {
|
||||
value = KeyState.Menu;
|
||||
}
|
||||
}
|
||||
|
||||
keyScopeReal(value);
|
||||
}
|
||||
});
|
||||
keyScopeReal(value);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
keyScopeReal.subscribe(value => shortcuts.setScope(value));
|
||||
|
||||
dropdownVisibility.subscribe(value => {
|
||||
if (value) {
|
||||
keyScope(KeyState.Menu);
|
||||
} else if (KeyState.Menu === shortcuts.getScope()) {
|
||||
keyScope(keyScopeFake());
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue