mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Cleanup .bind(
This commit is contained in:
parent
9ec84baa32
commit
29fe73d4e7
7 changed files with 143 additions and 246 deletions
|
|
@ -263,8 +263,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
addEventListener('mailbox.message-view.toggle-full-screen', () => this.toggleFullScreen());
|
||||
|
||||
this.attachmentPreview = this.attachmentPreview.bind(this);
|
||||
|
||||
decorateKoCommands(this, {
|
||||
closeMessageCommand: 1,
|
||||
messageEditCommand: self => self.messageVisibility(),
|
||||
|
|
@ -313,57 +311,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
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) {
|
||||
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Scope.MessageView));
|
||||
|
||||
|
|
@ -476,33 +423,28 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
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() {
|
||||
// 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
|
||||
shortcuts.add('enter,open', '', Scope.MessageView, () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue