mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-29 15:26:09 +00:00
Improved Contacts popup close handling
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { koArrayWithDestroy } from 'External/ko';
|
||||
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
|
||||
import { ComposeType } from 'Common/EnumsUser';
|
||||
|
||||
import { doc } from 'Common/Globals';
|
||||
import { arrayLength, pInt } from 'Common/Utils';
|
||||
import { download, computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||
|
||||
@@ -20,9 +19,11 @@ import { EmailModel } from 'Model/Email';
|
||||
import { ContactModel } from 'Model/Contact';
|
||||
import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
|
||||
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
import { AskPopupView } from 'View/Popup/Ask';
|
||||
|
||||
const
|
||||
CONTACTS_PER_PAGE = 50,
|
||||
ScopeContacts = 'Contacts',
|
||||
@@ -448,6 +449,9 @@ export class ContactsPopupView extends AbstractViewPopup {
|
||||
this.selector.init(dom.querySelector('.b-list-content'), ScopeContacts);
|
||||
|
||||
shortcuts.add('delete', '', ScopeContacts, () => {
|
||||
if (doc.activeElement && doc.activeElement.matches('input,textarea')) {
|
||||
return true;
|
||||
}
|
||||
this.deleteCommand();
|
||||
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) {
|
||||
this.bBackToCompose = !!bBackToCompose;
|
||||
this.sLastComposeFocusedField = sLastComposeFocusedField;
|
||||
|
||||
Reference in New Issue
Block a user