mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
Cleanup .bind(
This commit is contained in:
parent
9ec84baa32
commit
29fe73d4e7
7 changed files with 143 additions and 246 deletions
|
|
@ -11,31 +11,18 @@ export class CheckboxMaterialDesignComponent extends AbstractCheckbox {
|
||||||
this.animationBox = ko.observable(false).extend({ falseTimeout: 200 });
|
this.animationBox = ko.observable(false).extend({ falseTimeout: 200 });
|
||||||
this.animationCheckmark = ko.observable(false).extend({ falseTimeout: 200 });
|
this.animationCheckmark = ko.observable(false).extend({ falseTimeout: 200 });
|
||||||
|
|
||||||
this.animationBoxSetTrue = this.animationBoxSetTrue.bind(this);
|
|
||||||
this.animationCheckmarkSetTrue = this.animationCheckmarkSetTrue.bind(this);
|
|
||||||
|
|
||||||
this.disposable.push(
|
this.disposable.push(
|
||||||
this.value.subscribe((value) => {
|
this.value.subscribe(value => this.triggerAnimation(value), this)
|
||||||
this.triggerAnimation(value);
|
|
||||||
}, this)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
animationBoxSetTrue() {
|
|
||||||
this.animationBox(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
animationCheckmarkSetTrue() {
|
|
||||||
this.animationCheckmark(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
triggerAnimation(box) {
|
triggerAnimation(box) {
|
||||||
if (box) {
|
if (box) {
|
||||||
this.animationBoxSetTrue();
|
this.animationBox(true);
|
||||||
setTimeout(this.animationCheckmarkSetTrue, 200);
|
setTimeout(()=>this.animationCheckmark(true), 200);
|
||||||
} else {
|
} else {
|
||||||
this.animationCheckmarkSetTrue();
|
this.animationCheckmark(true);
|
||||||
setTimeout(this.animationBoxSetTrue, 200);
|
setTimeout(()=>this.animationBox(true), 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,8 +220,6 @@ export const MessageUserStore = new class {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessageResponse = this.onMessageResponse.bind(this);
|
|
||||||
|
|
||||||
this.purgeMessageBodyCacheThrottle = this.purgeMessageBodyCache.throttle(30000);
|
this.purgeMessageBodyCacheThrottle = this.purgeMessageBodyCache.throttle(30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,27 +628,20 @@ export const MessageUserStore = new class {
|
||||||
if (oMessage) {
|
if (oMessage) {
|
||||||
this.hideMessageBodies();
|
this.hideMessageBodies();
|
||||||
this.messageLoading(true);
|
this.messageLoading(true);
|
||||||
Remote.message(this.onMessageResponse, oMessage.folder, oMessage.uid);
|
Remote.message((iError, oData, bCached) => {
|
||||||
|
if (iError) {
|
||||||
|
if (Notification.RequestAborted !== iError) {
|
||||||
|
this.message(null);
|
||||||
|
this.messageError(getNotification(iError));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.setMessage(oData, bCached);
|
||||||
|
}
|
||||||
|
this.messageLoading(false);
|
||||||
|
}, oMessage.folder, oMessage.uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} sResult
|
|
||||||
* @param {FetchJsonDefaultResponse} oData
|
|
||||||
* @param {boolean} bCached
|
|
||||||
*/
|
|
||||||
onMessageResponse(iError, oData, bCached) {
|
|
||||||
if (iError) {
|
|
||||||
if (Notification.RequestAborted !== iError) {
|
|
||||||
this.message(null);
|
|
||||||
this.messageError(getNotification(iError));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.setMessage(oData, bCached);
|
|
||||||
}
|
|
||||||
this.messageLoading(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} list
|
* @param {Array} list
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,24 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
setFolderHash(sSentFolder, '');
|
setFolderHash(sSentFolder, '');
|
||||||
|
|
||||||
Remote.sendMessage(
|
Remote.sendMessage(
|
||||||
this.sendMessageResponse.bind(this),
|
(iError, data) => {
|
||||||
|
this.sending(false);
|
||||||
|
if (this.modalVisibility()) {
|
||||||
|
if (iError) {
|
||||||
|
if (Notification.CantSaveMessage === iError) {
|
||||||
|
this.sendSuccessButSaveError(true);
|
||||||
|
this.savedErrorDesc(i18n('COMPOSE/SAVED_ERROR_ON_SEND').trim());
|
||||||
|
} else {
|
||||||
|
this.sendError(true);
|
||||||
|
this.sendErrorDesc(getNotification(iError, data && data.ErrorMessage)
|
||||||
|
|| getNotification(Notification.CantSendMessage));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.closeCommand && this.closeCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.reloadDraftFolder();
|
||||||
|
},
|
||||||
this.getMessageRequestParams(sSentFolder)
|
this.getMessageRequestParams(sSentFolder)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -438,7 +455,40 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
setFolderHash(FolderUserStore.draftFolder(), '');
|
setFolderHash(FolderUserStore.draftFolder(), '');
|
||||||
|
|
||||||
Remote.saveMessage(
|
Remote.saveMessage(
|
||||||
this.saveMessageResponse.bind(this),
|
(iError, oData) => {
|
||||||
|
let result = false;
|
||||||
|
|
||||||
|
this.saving(false);
|
||||||
|
|
||||||
|
if (!iError) {
|
||||||
|
if (oData.Result.NewFolder && oData.Result.NewUid) {
|
||||||
|
result = true;
|
||||||
|
|
||||||
|
if (this.bFromDraft) {
|
||||||
|
const message = MessageUserStore.message();
|
||||||
|
if (message && this.draftFolder() === message.folder && this.draftUid() === message.uid) {
|
||||||
|
MessageUserStore.message(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.draftFolder(oData.Result.NewFolder);
|
||||||
|
this.draftUid(oData.Result.NewUid);
|
||||||
|
|
||||||
|
this.savedTime(new Date);
|
||||||
|
|
||||||
|
if (this.bFromDraft) {
|
||||||
|
setFolderHash(this.draftFolder(), '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
this.savedError(true);
|
||||||
|
this.savedErrorDesc(getNotification(Notification.CantSaveMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.reloadDraftFolder();
|
||||||
|
},
|
||||||
this.getMessageRequestParams(FolderUserStore.draftFolder())
|
this.getMessageRequestParams(FolderUserStore.draftFolder())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -578,63 +628,6 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessageResponse(iError, data) {
|
|
||||||
|
|
||||||
this.sending(false);
|
|
||||||
|
|
||||||
if (this.modalVisibility()) {
|
|
||||||
if (iError) {
|
|
||||||
if (Notification.CantSaveMessage === iError) {
|
|
||||||
this.sendSuccessButSaveError(true);
|
|
||||||
this.savedErrorDesc(i18n('COMPOSE/SAVED_ERROR_ON_SEND').trim());
|
|
||||||
} else {
|
|
||||||
this.sendError(true);
|
|
||||||
this.sendErrorDesc(getNotification(iError, data && data.ErrorMessage)
|
|
||||||
|| getNotification(Notification.CantSendMessage));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.closeCommand && this.closeCommand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.reloadDraftFolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
saveMessageResponse(iError, oData) {
|
|
||||||
let result = false;
|
|
||||||
|
|
||||||
this.saving(false);
|
|
||||||
|
|
||||||
if (!iError) {
|
|
||||||
if (oData.Result.NewFolder && oData.Result.NewUid) {
|
|
||||||
result = true;
|
|
||||||
|
|
||||||
if (this.bFromDraft) {
|
|
||||||
const message = MessageUserStore.message();
|
|
||||||
if (message && this.draftFolder() === message.folder && this.draftUid() === message.uid) {
|
|
||||||
MessageUserStore.message(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.draftFolder(oData.Result.NewFolder);
|
|
||||||
this.draftUid(oData.Result.NewUid);
|
|
||||||
|
|
||||||
this.savedTime(new Date);
|
|
||||||
|
|
||||||
if (this.bFromDraft) {
|
|
||||||
setFolderHash(this.draftFolder(), '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
this.savedError(true);
|
|
||||||
this.savedErrorDesc(getNotification(Notification.CantSaveMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.reloadDraftFolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
// Stop autosave
|
// Stop autosave
|
||||||
clearTimeout(this.iTimer);
|
clearTimeout(this.iTimer);
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
|
|
||||||
this.bDropPageAfterDelete = false;
|
this.bDropPageAfterDelete = false;
|
||||||
|
|
||||||
// this.saveCommandDebounce = _.debounce(this.saveCommand.bind(this), 1000);
|
// this.saveCommandDebounce = this.saveCommand.bind(this).debounce(1000);
|
||||||
|
|
||||||
const
|
const
|
||||||
// propertyFocused = property => !property.isValid() && !property.focused(),
|
// propertyFocused = property => !property.isValid() && !property.focused(),
|
||||||
|
|
@ -382,26 +382,18 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
|
|
||||||
deleteSelectedContacts() {
|
deleteSelectedContacts() {
|
||||||
if (this.contactsCheckedOrSelected().length) {
|
if (this.contactsCheckedOrSelected().length) {
|
||||||
Remote.contactsDelete(this.deleteResponse.bind(this), this.contactsCheckedOrSelectedUids());
|
Remote.contactsDelete((iError, oData) => {
|
||||||
|
if (500 < (!iError && oData && oData.Time ? pInt(oData.Time) : 0)) {
|
||||||
|
this.reloadContactList(this.bDropPageAfterDelete);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => this.reloadContactList(this.bDropPageAfterDelete), 500);
|
||||||
|
}
|
||||||
|
}, this.contactsCheckedOrSelectedUids());
|
||||||
|
|
||||||
this.removeCheckedOrSelectedContactsFromList();
|
this.removeCheckedOrSelectedContactsFromList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {int} iError
|
|
||||||
* @param {FetchJsonDefaultResponse} oData
|
|
||||||
*/
|
|
||||||
deleteResponse(iError, oData) {
|
|
||||||
if (500 < (!iError && oData && oData.Time ? pInt(oData.Time) : 0)) {
|
|
||||||
this.reloadContactList(this.bDropPageAfterDelete);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.reloadContactList(this.bDropPageAfterDelete);
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
removeProperty(oProp) {
|
removeProperty(oProp) {
|
||||||
this.viewProperties.remove(oProp);
|
this.viewProperties.remove(oProp);
|
||||||
delegateRunOnDestroy(oProp);
|
delegateRunOnDestroy(oProp);
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,48 @@ class DomainPopupView extends AbstractViewPopup {
|
||||||
this.testing(true);
|
this.testing(true);
|
||||||
|
|
||||||
Remote.testConnectionForDomain(
|
Remote.testConnectionForDomain(
|
||||||
this.onTestConnectionResponse.bind(this),
|
(iError, oData) => {
|
||||||
|
this.testing(false);
|
||||||
|
if (iError) {
|
||||||
|
this.testingImapError(true);
|
||||||
|
this.testingSieveError(true);
|
||||||
|
this.testingSmtpError(true);
|
||||||
|
this.sieveSettings(false);
|
||||||
|
} else {
|
||||||
|
let bImap = false,
|
||||||
|
bSieve = false;
|
||||||
|
|
||||||
|
this.testingDone(true);
|
||||||
|
this.testingImapError(true !== oData.Result.Imap);
|
||||||
|
this.testingSieveError(true !== oData.Result.Sieve);
|
||||||
|
this.testingSmtpError(true !== oData.Result.Smtp);
|
||||||
|
|
||||||
|
if (this.testingImapError() && oData.Result.Imap) {
|
||||||
|
bImap = true;
|
||||||
|
this.testingImapErrorDesc('');
|
||||||
|
this.testingImapErrorDesc(oData.Result.Imap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.testingSieveError() && oData.Result.Sieve) {
|
||||||
|
bSieve = true;
|
||||||
|
this.testingSieveErrorDesc('');
|
||||||
|
this.testingSieveErrorDesc(oData.Result.Sieve);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.testingSmtpError() && oData.Result.Smtp) {
|
||||||
|
this.testingSmtpErrorDesc('');
|
||||||
|
this.testingSmtpErrorDesc(oData.Result.Smtp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.sieveSettings()) {
|
||||||
|
if (!bSieve && bImap) {
|
||||||
|
this.sieveSettings(false);
|
||||||
|
}
|
||||||
|
} else if (bSieve && !bImap) {
|
||||||
|
this.sieveSettings(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -205,49 +246,6 @@ class DomainPopupView extends AbstractViewPopup {
|
||||||
this.clearTesting();
|
this.clearTesting();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTestConnectionResponse(iError, oData) {
|
|
||||||
this.testing(false);
|
|
||||||
if (iError) {
|
|
||||||
this.testingImapError(true);
|
|
||||||
this.testingSieveError(true);
|
|
||||||
this.testingSmtpError(true);
|
|
||||||
this.sieveSettings(false);
|
|
||||||
} else {
|
|
||||||
let bImap = false,
|
|
||||||
bSieve = false;
|
|
||||||
|
|
||||||
this.testingDone(true);
|
|
||||||
this.testingImapError(true !== oData.Result.Imap);
|
|
||||||
this.testingSieveError(true !== oData.Result.Sieve);
|
|
||||||
this.testingSmtpError(true !== oData.Result.Smtp);
|
|
||||||
|
|
||||||
if (this.testingImapError() && oData.Result.Imap) {
|
|
||||||
bImap = true;
|
|
||||||
this.testingImapErrorDesc('');
|
|
||||||
this.testingImapErrorDesc(oData.Result.Imap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.testingSieveError() && oData.Result.Sieve) {
|
|
||||||
bSieve = true;
|
|
||||||
this.testingSieveErrorDesc('');
|
|
||||||
this.testingSieveErrorDesc(oData.Result.Sieve);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.testingSmtpError() && oData.Result.Smtp) {
|
|
||||||
this.testingSmtpErrorDesc('');
|
|
||||||
this.testingSmtpErrorDesc(oData.Result.Smtp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.sieveSettings()) {
|
|
||||||
if (!bSieve && bImap) {
|
|
||||||
this.sieveSettings(false);
|
|
||||||
}
|
|
||||||
} else if (bSieve && !bImap) {
|
|
||||||
this.sieveSettings(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onDomainCreateOrSaveResponse(iError) {
|
onDomainCreateOrSaveResponse(iError) {
|
||||||
this.saving(false);
|
this.saving(false);
|
||||||
if (iError) {
|
if (iError) {
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ class PluginPopupView extends AbstractViewPopup {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('Plugin');
|
super('Plugin');
|
||||||
|
|
||||||
this.onPluginSettingsUpdateResponse = this.onPluginSettingsUpdateResponse.bind(this);
|
|
||||||
|
|
||||||
this.addObservables({
|
this.addObservables({
|
||||||
saveError: '',
|
saveError: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
|
@ -50,15 +48,11 @@ class PluginPopupView extends AbstractViewPopup {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.saveError('');
|
this.saveError('');
|
||||||
Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, list);
|
Remote.pluginSettingsUpdate(iError =>
|
||||||
}
|
iError
|
||||||
|
? this.saveError(getNotification(iError))
|
||||||
onPluginSettingsUpdateResponse(iError) {
|
: this.cancelCommand()
|
||||||
if (iError) {
|
, list);
|
||||||
this.saveError(getNotification(iError));
|
|
||||||
} else {
|
|
||||||
this.cancelCommand();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow(oPlugin) {
|
onShow(oPlugin) {
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
addEventListener('mailbox.message-view.toggle-full-screen', () => this.toggleFullScreen());
|
addEventListener('mailbox.message-view.toggle-full-screen', () => this.toggleFullScreen());
|
||||||
|
|
||||||
this.attachmentPreview = this.attachmentPreview.bind(this);
|
|
||||||
|
|
||||||
decorateKoCommands(this, {
|
decorateKoCommands(this, {
|
||||||
closeMessageCommand: 1,
|
closeMessageCommand: 1,
|
||||||
messageEditCommand: self => self.messageVisibility(),
|
messageEditCommand: self => self.messageVisibility(),
|
||||||
|
|
@ -313,57 +311,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
this.oHeaderDom && this.viewBodyTopValue(this.message() ? this.oHeaderDom.offsetHeight : 0);
|
this.oHeaderDom && this.viewBodyTopValue(this.message() ? this.oHeaderDom.offsetHeight : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// displayMailToPopup(sMailToUrl) {
|
|
||||||
// sMailToUrl = sMailToUrl.replace(/\?.+$/, '');
|
|
||||||
//
|
|
||||||
// var
|
|
||||||
// sResult = '',
|
|
||||||
// aTo = [],
|
|
||||||
// EmailModel = require('Model/Email').default,
|
|
||||||
// fParseEmailLine = function(sLine) {
|
|
||||||
// return sLine ? [decodeURIComponent(sLine)].map(sItem => {
|
|
||||||
// var oEmailModel = new EmailModel();
|
|
||||||
// oEmailModel.parse(sItem);
|
|
||||||
// return oEmailModel.email ? oEmailModel : null;
|
|
||||||
// }).filter(v => v) : null;
|
|
||||||
// }
|
|
||||||
// ;
|
|
||||||
//
|
|
||||||
// aTo = fParseEmailLine(sMailToUrl);
|
|
||||||
// sResult = aTo && aTo[0] ? aTo[0].email : '';
|
|
||||||
//
|
|
||||||
// return sResult;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} oAttachment
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
attachmentPreview(/*attachment*/) {
|
|
||||||
/*
|
|
||||||
if (attachment && attachment.isImage() && !attachment.isLinked && this.message() && this.message().attachments()) {
|
|
||||||
const items = this.message().attachments.map(item => {
|
|
||||||
if (item && !item.isLinked && item.isImage()) {
|
|
||||||
if (item === attachment) {
|
|
||||||
index = listIndex;
|
|
||||||
}
|
|
||||||
++listIndex;
|
|
||||||
return {
|
|
||||||
src: item.linkPreview(),
|
|
||||||
msrc: item.linkThumbnail(),
|
|
||||||
title: item.fileName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}).filter(v => v);
|
|
||||||
|
|
||||||
if (items.length) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Scope.MessageView));
|
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Scope.MessageView));
|
||||||
|
|
||||||
|
|
@ -476,33 +423,28 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
this.initShortcuts();
|
this.initShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
escShortcuts() {
|
|
||||||
if (this.viewModelVisible && this.message()) {
|
|
||||||
const preview = SettingsUserStore.usePreviewPane();
|
|
||||||
if (this.fullScreenMode()) {
|
|
||||||
this.fullScreenMode(false);
|
|
||||||
|
|
||||||
if (preview) {
|
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
|
||||||
}
|
|
||||||
} else if (!preview) {
|
|
||||||
this.message(null);
|
|
||||||
} else {
|
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
initShortcuts() {
|
initShortcuts() {
|
||||||
// exit fullscreen, back
|
// exit fullscreen, back
|
||||||
shortcuts.add('escape,backspace', '', Scope.MessageView, this.escShortcuts.bind(this));
|
shortcuts.add('escape,backspace', '', Scope.MessageView, () => {
|
||||||
|
if (this.viewModelVisible && this.message()) {
|
||||||
|
const preview = SettingsUserStore.usePreviewPane();
|
||||||
|
if (this.fullScreenMode()) {
|
||||||
|
this.fullScreenMode(false);
|
||||||
|
|
||||||
|
if (preview) {
|
||||||
|
AppUserStore.focusedState(Scope.MessageList);
|
||||||
|
}
|
||||||
|
} else if (!preview) {
|
||||||
|
this.message(null);
|
||||||
|
} else {
|
||||||
|
AppUserStore.focusedState(Scope.MessageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
// fullscreen
|
// fullscreen
|
||||||
shortcuts.add('enter,open', '', Scope.MessageView, () => {
|
shortcuts.add('enter,open', '', Scope.MessageView, () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue