mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Drop the ko.bindingHandlers.modal as click.koModal is never used
And replace hideScreenPopup() with this.closeCommand();
This commit is contained in:
parent
2e34f98c80
commit
880d4a05e9
30 changed files with 66 additions and 69 deletions
|
|
@ -13,8 +13,6 @@ class AbstractView {
|
|||
this.viewType = type;
|
||||
this.viewModelDom = null;
|
||||
|
||||
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||
|
||||
this.keyScope = {
|
||||
scope: Scope.None,
|
||||
previous: Scope.None,
|
||||
|
|
@ -62,6 +60,7 @@ export class AbstractViewPopup extends AbstractView
|
|||
this.keyScope.scope = Scope[name];
|
||||
}
|
||||
this.bDisabeCloseOnEsc = false;
|
||||
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||
}
|
||||
/*
|
||||
onShowWithDelay() {}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,7 @@ const
|
|||
ViewModelClass.__dom = vmDom;
|
||||
|
||||
if (ViewType.Popup === position) {
|
||||
vm.cancelCommand = vm.closeCommand = createCommand(() => {
|
||||
hideScreenPopup(ViewModelClass);
|
||||
});
|
||||
vm.cancelCommand = vm.closeCommand = createCommand(() => hideScreenPopup(ViewModelClass));
|
||||
|
||||
// show/hide popup/modal
|
||||
const endShowHide = e => {
|
||||
|
|
@ -81,6 +79,17 @@ const
|
|||
arePopupsVisible(0 < visiblePopups.size);
|
||||
}
|
||||
vmDom.setAttribute('aria-hidden', !value);
|
||||
/*
|
||||
// the old ko.bindingHandlers.modal
|
||||
const close = vmDom.querySelector('.close'),
|
||||
click = () => vm.modalVisibility(false);
|
||||
if (close) {
|
||||
close.addEventListener('click.koModal', click);
|
||||
ko.utils.domNodeDisposal.addDisposeCallback(vmDom, () =>
|
||||
close.removeEventListener('click.koModal', click)
|
||||
);
|
||||
}
|
||||
*/
|
||||
});
|
||||
if ('ontransitionend' in vmDom) {
|
||||
vmDom.addEventListener('transitionend', endShowHide);
|
||||
|
|
@ -134,6 +143,16 @@ const
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Function} ViewModelClassToHide
|
||||
* @returns {void}
|
||||
*/
|
||||
hideScreenPopup = ViewModelClassToHide => {
|
||||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) {
|
||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} screenName
|
||||
* @param {string} subPart
|
||||
|
|
@ -236,16 +255,6 @@ export const
|
|||
return fResult;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Function} ViewModelClassToHide
|
||||
* @returns {void}
|
||||
*/
|
||||
hideScreenPopup = ViewModelClassToHide => {
|
||||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) {
|
||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
||||
}
|
||||
},
|
||||
|
||||
getScreenPopupViewModel = ViewModelClassToShow =>
|
||||
(buildViewModel(ViewModelClassToShow) && ViewModelClassToShow.__dom) && ViewModelClassToShow.__vm,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue