mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
es5 -> es2015 (last stage)
Signature plugin fixes Add view decorator A large number of fixes
This commit is contained in:
parent
e88c193334
commit
17669b7be0
153 changed files with 21193 additions and 21115 deletions
64
dev/Knoin/AbstractViewNext.js
Normal file
64
dev/Knoin/AbstractViewNext.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {delegateRun, inFocus} from 'Common/Utils';
|
||||
import {KeyState, EventKeyCode} from 'Common/Enums';
|
||||
import {$win, keyScope} from 'Common/Globals';
|
||||
|
||||
class AbstractViewNext
|
||||
{
|
||||
constructor() {
|
||||
this.bDisabeCloseOnEsc = false;
|
||||
this.sDefaultKeyScope = KeyState.None;
|
||||
this.sCurrentKeyScope = this.sDefaultKeyScope;
|
||||
|
||||
this.viewModelVisibility = ko.observable(false);
|
||||
this.modalVisibility = ko.observable(false).extend({rateLimit: 0});
|
||||
|
||||
this.viewModelName = '';
|
||||
this.viewModelNames = [];
|
||||
this.viewModelDom = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
storeAndSetKeyScope() {
|
||||
this.sCurrentKeyScope = keyScope();
|
||||
keyScope(this.sDefaultKeyScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
restoreKeyScope() {
|
||||
keyScope(this.sCurrentKeyScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
registerPopupKeyDown() {
|
||||
$win.on('keydown', (event) => {
|
||||
if (event && this.modalVisibility && this.modalVisibility())
|
||||
{
|
||||
if (!this.bDisabeCloseOnEsc && EventKeyCode.Esc === event.keyCode)
|
||||
{
|
||||
delegateRun(this, 'cancelCommand');
|
||||
return false;
|
||||
}
|
||||
else if (EventKeyCode.Backspace === event.keyCode && !inFocus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
cancelCommand() {} // eslint-disable-line no-empty-function
|
||||
closeCommand() {} // eslint-disable-line no-empty-function
|
||||
}
|
||||
|
||||
export {AbstractViewNext, AbstractViewNext as default};
|
||||
Loading…
Add table
Add a link
Reference in a new issue