mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved Contacts popup close handling
This commit is contained in:
parent
fafe56ecb4
commit
a67fb22bee
1 changed files with 17 additions and 3 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
import { koArrayWithDestroy } from 'External/ko';
|
import { koArrayWithDestroy } from 'External/ko';
|
||||||
|
|
||||||
import { SaveSettingsStep } from 'Common/Enums';
|
import { SaveSettingsStep } from 'Common/Enums';
|
||||||
|
|
||||||
import { ComposeType } from 'Common/EnumsUser';
|
import { ComposeType } from 'Common/EnumsUser';
|
||||||
|
import { doc } from 'Common/Globals';
|
||||||
import { arrayLength, pInt } from 'Common/Utils';
|
import { arrayLength, pInt } from 'Common/Utils';
|
||||||
import { download, computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
import { download, computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||||
|
|
||||||
|
|
@ -20,9 +19,11 @@ import { EmailModel } from 'Model/Email';
|
||||||
import { ContactModel } from 'Model/Contact';
|
import { ContactModel } from 'Model/Contact';
|
||||||
import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
|
import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
|
||||||
|
|
||||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||||
|
|
||||||
|
import { AskPopupView } from 'View/Popup/Ask';
|
||||||
|
|
||||||
const
|
const
|
||||||
CONTACTS_PER_PAGE = 50,
|
CONTACTS_PER_PAGE = 50,
|
||||||
ScopeContacts = 'Contacts',
|
ScopeContacts = 'Contacts',
|
||||||
|
|
@ -448,6 +449,9 @@ export class ContactsPopupView extends AbstractViewPopup {
|
||||||
this.selector.init(dom.querySelector('.b-list-content'), ScopeContacts);
|
this.selector.init(dom.querySelector('.b-list-content'), ScopeContacts);
|
||||||
|
|
||||||
shortcuts.add('delete', '', ScopeContacts, () => {
|
shortcuts.add('delete', '', ScopeContacts, () => {
|
||||||
|
if (doc.activeElement && doc.activeElement.matches('input,textarea')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
this.deleteCommand();
|
this.deleteCommand();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
@ -491,6 +495,16 @@ export class ContactsPopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
if (this.watchDirty() && AskPopupView.hidden()) {
|
||||||
|
showScreenPopup(AskPopupView, [
|
||||||
|
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
||||||
|
() => this.closeCommand()
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onShow(bBackToCompose, sLastComposeFocusedField) {
|
onShow(bBackToCompose, sLastComposeFocusedField) {
|
||||||
this.bBackToCompose = !!bBackToCompose;
|
this.bBackToCompose = !!bBackToCompose;
|
||||||
this.sLastComposeFocusedField = sLastComposeFocusedField;
|
this.sLastComposeFocusedField = sLastComposeFocusedField;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue