mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Cleanup some code
This commit is contained in:
parent
8d51e57d41
commit
8b116fa8ba
8 changed files with 227 additions and 276 deletions
|
|
@ -312,7 +312,7 @@ export function startScreens(screensClasses) {
|
|||
setTimeout(() => $htmlCL.add('rl-started-delay'), 200);
|
||||
}
|
||||
|
||||
function decorateKoCommands(thisArg, commands) {
|
||||
export function decorateKoCommands(thisArg, commands) {
|
||||
Object.entries(commands).forEach(([key, canExecute]) => {
|
||||
let command = thisArg[key],
|
||||
fn = (...args) => fn.enabled() && fn.canExecute() && command.apply(thisArg, args);
|
||||
|
|
@ -330,29 +330,3 @@ function decorateKoCommands(thisArg, commands) {
|
|||
});
|
||||
}
|
||||
ko.decorateCommands = decorateKoCommands;
|
||||
|
||||
/**
|
||||
* @param {miced} $items
|
||||
* @returns {Function}
|
||||
*/
|
||||
function settingsMenuKeysHandler(items) {
|
||||
return ((event, handler)=>{
|
||||
let index = items.length;
|
||||
if (event && index) {
|
||||
while (index-- && !items[index].matches('.selected'));
|
||||
if (handler && 'arrowup' === handler.shortcut) {
|
||||
index && --index;
|
||||
} else if (index < items.length - 1) {
|
||||
++index;
|
||||
}
|
||||
|
||||
const resultHash = items[index].href;
|
||||
resultHash && rl.route.setHash(resultHash, false, true);
|
||||
}
|
||||
}).throttle(200);
|
||||
}
|
||||
|
||||
export {
|
||||
decorateKoCommands,
|
||||
settingsMenuKeysHandler
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,23 +52,8 @@ export class ThemesUserSettings {
|
|||
}))
|
||||
);
|
||||
|
||||
this.initUploader();
|
||||
}
|
||||
// initUploader
|
||||
|
||||
onShow() {
|
||||
this.background.error('');
|
||||
}
|
||||
|
||||
clearBackground() {
|
||||
if (this.capaUserBackground()) {
|
||||
Remote.clearUserBackground(() => {
|
||||
this.background.name('');
|
||||
this.background.hash('');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
initUploader() {
|
||||
if (this.background.uploaderButton() && this.capaUserBackground()) {
|
||||
const oJua = new Jua({
|
||||
action: serverRequest('UploadBackground'),
|
||||
|
|
@ -119,4 +104,17 @@ export class ThemesUserSettings {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
onShow() {
|
||||
this.background.error('');
|
||||
}
|
||||
|
||||
clearBackground() {
|
||||
if (this.capaUserBackground()) {
|
||||
Remote.clearUserBackground(() => {
|
||||
this.background.name('');
|
||||
this.background.hash('');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
|
||||
composeUploaderButton: null,
|
||||
composeUploaderDropPlace: null,
|
||||
dragAndDropEnabled: false,
|
||||
attacheMultipleAllowed: false,
|
||||
addAttachmentEnabled: false,
|
||||
|
||||
|
|
@ -1090,7 +1089,127 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
this.initUploader();
|
||||
// initUploader
|
||||
|
||||
if (this.composeUploaderButton()) {
|
||||
const uploadCache = {},
|
||||
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
|
||||
oJua = new Jua({
|
||||
action: serverRequest('Upload'),
|
||||
name: 'uploader',
|
||||
queueSize: 2,
|
||||
multipleSizeLimit: 50,
|
||||
clickElement: this.composeUploaderButton(),
|
||||
dragAndDropElement: this.composeUploaderDropPlace()
|
||||
});
|
||||
|
||||
oJua
|
||||
// .on('onLimitReached', (limit) => {
|
||||
// alert(limit);
|
||||
// })
|
||||
.on('onDragEnter', () => {
|
||||
this.dragAndDropOver(true);
|
||||
})
|
||||
.on('onDragLeave', () => {
|
||||
this.dragAndDropOver(false);
|
||||
})
|
||||
.on('onBodyDragEnter', () => {
|
||||
this.attachmentsPlace(true);
|
||||
this.dragAndDropVisible(true);
|
||||
})
|
||||
.on('onBodyDragLeave', () => {
|
||||
this.dragAndDropVisible(false);
|
||||
})
|
||||
.on('onProgress', (id, loaded, total) => {
|
||||
let item = uploadCache[id];
|
||||
if (!item) {
|
||||
item = this.getAttachmentById(id);
|
||||
if (item) {
|
||||
uploadCache[id] = item;
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
item.progress(Math.floor((loaded / total) * 100));
|
||||
}
|
||||
})
|
||||
.on('onSelect', (sId, oData) => {
|
||||
this.dragAndDropOver(false);
|
||||
|
||||
const fileName = undefined === oData.FileName ? '' : oData.FileName.toString(),
|
||||
size = pInt(oData.Size, null),
|
||||
attachment = new ComposeAttachmentModel(sId, fileName, size);
|
||||
|
||||
attachment.cancel = this.cancelAttachmentHelper(sId, oJua);
|
||||
|
||||
this.attachments.push(attachment);
|
||||
|
||||
this.attachmentsPlace(true);
|
||||
|
||||
if (0 < size && 0 < attachmentSizeLimit && attachmentSizeLimit < size) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(true)
|
||||
.complete(true)
|
||||
.error(i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
.on('onStart', (id) => {
|
||||
let item = uploadCache[id];
|
||||
if (!item) {
|
||||
item = this.getAttachmentById(id);
|
||||
if (item) {
|
||||
uploadCache[id] = item;
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
item
|
||||
.waiting(false)
|
||||
.uploading(true)
|
||||
.complete(false);
|
||||
}
|
||||
})
|
||||
.on('onComplete', (id, result, data) => {
|
||||
const attachment = this.getAttachmentById(id),
|
||||
errorCode = data && data.Result && data.Result.ErrorCode ? data.Result.ErrorCode : null,
|
||||
attachmentJson = result && data && data.Result && data.Result.Attachment ? data.Result.Attachment : null;
|
||||
|
||||
let error = '';
|
||||
if (null !== errorCode) {
|
||||
error = getUploadErrorDescByCode(errorCode);
|
||||
} else if (!attachmentJson) {
|
||||
error = i18n('UPLOAD/ERROR_UNKNOWN');
|
||||
}
|
||||
|
||||
if (attachment) {
|
||||
if (error && error.length) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(false)
|
||||
.complete(true)
|
||||
.error(error);
|
||||
} else if (attachmentJson) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(false)
|
||||
.complete(true);
|
||||
|
||||
attachment.initByUploadJson(attachmentJson);
|
||||
}
|
||||
|
||||
if (undefined === uploadCache[id]) {
|
||||
delete uploadCache[id];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.addAttachmentEnabled(true);
|
||||
}
|
||||
|
||||
shortcuts.add('q', 'meta', Scope.Compose, ()=>false);
|
||||
shortcuts.add('w', 'meta', Scope.Compose, ()=>false);
|
||||
|
|
@ -1180,132 +1299,6 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
};
|
||||
}
|
||||
|
||||
initUploader() {
|
||||
if (this.composeUploaderButton()) {
|
||||
const uploadCache = {},
|
||||
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
|
||||
oJua = new Jua({
|
||||
action: serverRequest('Upload'),
|
||||
name: 'uploader',
|
||||
queueSize: 2,
|
||||
multipleSizeLimit: 50,
|
||||
clickElement: this.composeUploaderButton(),
|
||||
dragAndDropElement: this.composeUploaderDropPlace()
|
||||
});
|
||||
|
||||
if (oJua) {
|
||||
oJua
|
||||
// .on('onLimitReached', (limit) => {
|
||||
// alert(limit);
|
||||
// })
|
||||
.on('onDragEnter', () => {
|
||||
this.dragAndDropOver(true);
|
||||
})
|
||||
.on('onDragLeave', () => {
|
||||
this.dragAndDropOver(false);
|
||||
})
|
||||
.on('onBodyDragEnter', () => {
|
||||
this.attachmentsPlace(true);
|
||||
this.dragAndDropVisible(true);
|
||||
})
|
||||
.on('onBodyDragLeave', () => {
|
||||
this.dragAndDropVisible(false);
|
||||
})
|
||||
.on('onProgress', (id, loaded, total) => {
|
||||
let item = uploadCache[id];
|
||||
if (!item) {
|
||||
item = this.getAttachmentById(id);
|
||||
if (item) {
|
||||
uploadCache[id] = item;
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
item.progress(Math.floor((loaded / total) * 100));
|
||||
}
|
||||
})
|
||||
.on('onSelect', (sId, oData) => {
|
||||
this.dragAndDropOver(false);
|
||||
|
||||
const fileName = undefined === oData.FileName ? '' : oData.FileName.toString(),
|
||||
size = pInt(oData.Size, null),
|
||||
attachment = new ComposeAttachmentModel(sId, fileName, size);
|
||||
|
||||
attachment.cancel = this.cancelAttachmentHelper(sId, oJua);
|
||||
|
||||
this.attachments.push(attachment);
|
||||
|
||||
this.attachmentsPlace(true);
|
||||
|
||||
if (0 < size && 0 < attachmentSizeLimit && attachmentSizeLimit < size) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(true)
|
||||
.complete(true)
|
||||
.error(i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
.on('onStart', (id) => {
|
||||
let item = uploadCache[id];
|
||||
if (!item) {
|
||||
item = this.getAttachmentById(id);
|
||||
if (item) {
|
||||
uploadCache[id] = item;
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
item
|
||||
.waiting(false)
|
||||
.uploading(true)
|
||||
.complete(false);
|
||||
}
|
||||
})
|
||||
.on('onComplete', (id, result, data) => {
|
||||
const attachment = this.getAttachmentById(id),
|
||||
errorCode = data && data.Result && data.Result.ErrorCode ? data.Result.ErrorCode : null,
|
||||
attachmentJson = result && data && data.Result && data.Result.Attachment ? data.Result.Attachment : null;
|
||||
|
||||
let error = '';
|
||||
if (null !== errorCode) {
|
||||
error = getUploadErrorDescByCode(errorCode);
|
||||
} else if (!attachmentJson) {
|
||||
error = i18n('UPLOAD/ERROR_UNKNOWN');
|
||||
}
|
||||
|
||||
if (attachment) {
|
||||
if (error && error.length) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(false)
|
||||
.complete(true)
|
||||
.error(error);
|
||||
} else if (attachmentJson) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(false)
|
||||
.complete(true);
|
||||
|
||||
attachment.initByUploadJson(attachmentJson);
|
||||
}
|
||||
|
||||
if (undefined === uploadCache[id]) {
|
||||
delete uploadCache[id];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.addAttachmentEnabled(true).dragAndDropEnabled(true);
|
||||
} else {
|
||||
this.addAttachmentEnabled(false).dragAndDropEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -324,32 +324,6 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
rl.app.download(serverRequestRaw('ContactsCsv'));
|
||||
}
|
||||
|
||||
initUploader() {
|
||||
if (this.importUploaderButton()) {
|
||||
const j = new Jua({
|
||||
action: serverRequest('UploadContacts'),
|
||||
name: 'uploader',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
disableMultiple: true,
|
||||
disableDocumentDropPrevent: true,
|
||||
clickElement: this.importUploaderButton()
|
||||
});
|
||||
|
||||
if (j) {
|
||||
j.on('onStart', () => {
|
||||
ContactUserStore.importing(true);
|
||||
}).on('onComplete', (id, result, data) => {
|
||||
ContactUserStore.importing(false);
|
||||
this.reloadContactList();
|
||||
if (!id || !result || !data || !data.Result) {
|
||||
alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeCheckedOrSelectedContactsFromList() {
|
||||
const contacts = this.contactsCheckedOrSelected();
|
||||
|
||||
|
|
@ -494,7 +468,31 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
}
|
||||
});
|
||||
|
||||
this.initUploader();
|
||||
// initUploader
|
||||
|
||||
if (this.importUploaderButton()) {
|
||||
const j = new Jua({
|
||||
action: serverRequest('UploadContacts'),
|
||||
name: 'uploader',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
disableMultiple: true,
|
||||
disableDocumentDropPrevent: true,
|
||||
clickElement: this.importUploaderButton()
|
||||
});
|
||||
|
||||
if (j) {
|
||||
j.on('onStart', () => {
|
||||
ContactUserStore.importing(true);
|
||||
}).on('onComplete', (id, result, data) => {
|
||||
ContactUserStore.importing(false);
|
||||
this.reloadContactList();
|
||||
if (!id || !result || !data || !data.Result) {
|
||||
alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onShow(bBackToCompose, sLastComposeFocusedField) {
|
||||
|
|
|
|||
|
|
@ -706,15 +706,41 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
el && this.gotoThread(ko.dataFor(el));
|
||||
});
|
||||
|
||||
this.initUploaderForAppend();
|
||||
this.initShortcuts();
|
||||
// initUploaderForAppend
|
||||
|
||||
if (!ThemeStore.isMobile() && Settings.capa(Capa.Prefetch)) {
|
||||
ifvisible.idle(this.prefetchNextTick.bind(this));
|
||||
if (Settings.app('allowAppendMessage') && this.dragOverArea()) {
|
||||
const oJua = new Jua({
|
||||
action: serverRequest('Append'),
|
||||
name: 'AppendFile',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
hidden: {
|
||||
Folder: () => FolderUserStore.currentFolderFullNameRaw()
|
||||
},
|
||||
dragAndDropElement: this.dragOverArea(),
|
||||
dragAndDropBodyElement: this.dragOverBodyArea()
|
||||
});
|
||||
|
||||
this.dragOver.subscribe(value => value && this.selector.scrollToTop());
|
||||
|
||||
oJua
|
||||
.on('onDragEnter', () => this.dragOverEnter(true))
|
||||
.on('onDragLeave', () => this.dragOverEnter(false))
|
||||
.on('onBodyDragEnter', () => this.dragOver(true))
|
||||
.on('onBodyDragLeave', () => this.dragOver(false))
|
||||
.on('onSelect', (sUid, oData) => {
|
||||
if (sUid && oData && 'message/rfc822' === oData.Type) {
|
||||
MessageUserStore.listLoading(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.on('onComplete', () => rl.app.reloadMessageList(true, true));
|
||||
}
|
||||
}
|
||||
|
||||
initShortcuts() {
|
||||
// initShortcuts
|
||||
|
||||
shortcuts.add('enter,open', '', Scope.MessageList, () => {
|
||||
if (MessageUserStore.message() && this.useAutoSelect()) {
|
||||
dispatchEvent(new CustomEvent('mailbox.message-view.toggle-full-screen'));
|
||||
|
|
@ -855,6 +881,10 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
shortcuts.add('arrowleft', 'meta', Scope.MessageView, ()=>false);
|
||||
shortcuts.add('arrowright', 'meta', Scope.MessageView, ()=>false);
|
||||
|
||||
if (!ThemeStore.isMobile() && Settings.capa(Capa.Prefetch)) {
|
||||
ifvisible.idle(this.prefetchNextTick.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
prefetchNextTick() {
|
||||
|
|
@ -894,41 +924,4 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
LIMIT: FileInfo.friendlySize(QuotaUserStore.quota())
|
||||
}).replace(/<[^>]+>/g, '');
|
||||
}
|
||||
|
||||
initUploaderForAppend() {
|
||||
if (!Settings.app('allowAppendMessage') || !this.dragOverArea()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const oJua = new Jua({
|
||||
action: serverRequest('Append'),
|
||||
name: 'AppendFile',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
hidden: {
|
||||
Folder: () => FolderUserStore.currentFolderFullNameRaw()
|
||||
},
|
||||
dragAndDropElement: this.dragOverArea(),
|
||||
dragAndDropBodyElement: this.dragOverBodyArea()
|
||||
});
|
||||
|
||||
this.dragOver.subscribe(value => value && this.selector.scrollToTop());
|
||||
|
||||
oJua
|
||||
.on('onDragEnter', () => this.dragOverEnter(true))
|
||||
.on('onDragLeave', () => this.dragOverEnter(false))
|
||||
.on('onBodyDragEnter', () => this.dragOver(true))
|
||||
.on('onBodyDragLeave', () => this.dragOver(false))
|
||||
.on('onSelect', (sUid, oData) => {
|
||||
if (sUid && oData && 'message/rfc822' === oData.Type) {
|
||||
MessageUserStore.listLoading(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.on('onComplete', () => rl.app.reloadMessageList(true, true));
|
||||
|
||||
return !!oJua;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
createCommandActionHelper = (folderType, useFolder) =>
|
||||
createCommand(() => {
|
||||
const message = this.message();
|
||||
const message = MessageUserStore.message();
|
||||
if (message && this.allowMessageListActions) {
|
||||
this.message(null);
|
||||
MessageUserStore.message(null);
|
||||
rl.app.deleteMessagesFromFolder(folderType, message.folder, [message.uid], useFolder);
|
||||
}
|
||||
}, this.messageVisibility);
|
||||
|
|
@ -84,9 +84,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
|
||||
this.messageLoadingThrottle = MessageUserStore.messageLoading;
|
||||
this.messagesBodiesDom = MessageUserStore.messagesBodiesDom;
|
||||
this.useThreads = SettingsUserStore.useThreads;
|
||||
this.replySameFolder = SettingsUserStore.replySameFolder;
|
||||
this.layout = SettingsUserStore.layout;
|
||||
this.isMessageSelected = MessageUserStore.isMessageSelected;
|
||||
this.messageActiveDom = MessageUserStore.messageActiveDom;
|
||||
this.messageError = MessageUserStore.messageError;
|
||||
|
|
@ -157,7 +154,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
)
|
||||
},
|
||||
|
||||
messageVisibility: () => !MessageUserStore.messageLoading() && !!this.message(),
|
||||
messageVisibility: () => !MessageUserStore.messageLoading() && !!MessageUserStore.message(),
|
||||
|
||||
canBeRepliedOrForwarded: () => !this.isDraftFolder() && this.messageVisibility(),
|
||||
|
||||
|
|
@ -190,8 +187,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
this.addSubscribables({
|
||||
showAttachmnetControls: v => this.message()
|
||||
&& this.message().attachments.forEach(item => item && item.checked(!!v)),
|
||||
showAttachmnetControls: v => MessageUserStore.message()
|
||||
&& MessageUserStore.message().attachments.forEach(item => item && item.checked(!!v)),
|
||||
|
||||
lastReplyAction_: value => Local.set(ClientSideKeyName.LastReplyAction, value),
|
||||
|
||||
|
|
@ -253,7 +250,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
MessageUserStore.messageViewTrigger.subscribe(() => {
|
||||
const message = this.message();
|
||||
const message = MessageUserStore.message();
|
||||
this.viewIsFlagged(message ? message.isFlagged() : false);
|
||||
});
|
||||
|
||||
|
|
@ -279,13 +276,13 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
goUpCommand() {
|
||||
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-up',
|
||||
{detail:SettingsUserStore.usePreviewPane() || !!this.message()} // bForceSelect
|
||||
{detail:SettingsUserStore.usePreviewPane() || !!MessageUserStore.message()} // bForceSelect
|
||||
));
|
||||
}
|
||||
|
||||
goDownCommand() {
|
||||
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-down',
|
||||
{detail:SettingsUserStore.usePreviewPane() || !!this.message()} // bForceSelect
|
||||
{detail:SettingsUserStore.usePreviewPane() || !!MessageUserStore.message()} // bForceSelect
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -306,11 +303,12 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
checkHeaderHeight() {
|
||||
this.oHeaderDom && this.viewBodyTopValue(this.message() ? this.oHeaderDom.offsetHeight : 0);
|
||||
this.oHeaderDom && this.viewBodyTopValue(MessageUserStore.message() ? this.oHeaderDom.offsetHeight : 0);
|
||||
}
|
||||
|
||||
onBuild(dom) {
|
||||
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Scope.MessageView));
|
||||
this.fullScreenMode.subscribe(value =>
|
||||
value && MessageUserStore.message() && AppUserStore.focusedState(Scope.MessageView));
|
||||
|
||||
this.showFullInfo.subscribe(value => Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0'));
|
||||
|
||||
|
|
@ -384,7 +382,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
if (eqs(event, '.messageItemHeader .subjectParent .flagParent')) {
|
||||
const message = this.message();
|
||||
const message = MessageUserStore.message();
|
||||
message && rl.app.messageListAction(
|
||||
message.folder,
|
||||
message.isFlagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
||||
|
|
@ -418,13 +416,11 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
this.oMessageScrollerDom = dom.querySelector('.messageItem');
|
||||
|
||||
this.initShortcuts();
|
||||
}
|
||||
// initShortcuts
|
||||
|
||||
initShortcuts() {
|
||||
// exit fullscreen, back
|
||||
shortcuts.add('escape,backspace', '', Scope.MessageView, () => {
|
||||
if (this.viewModelVisible && this.message()) {
|
||||
if (this.viewModelVisible && MessageUserStore.message()) {
|
||||
const preview = SettingsUserStore.usePreviewPane();
|
||||
if (this.fullScreenMode()) {
|
||||
this.fullScreenMode(false);
|
||||
|
|
@ -433,7 +429,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
} else if (!preview) {
|
||||
this.message(null);
|
||||
MessageUserStore.message(null);
|
||||
} else {
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
|
|
@ -459,7 +455,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
return true;
|
||||
});
|
||||
|
||||
// replaAll
|
||||
// replyAll
|
||||
shortcuts.add('a', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
if (MessageUserStore.message()) {
|
||||
this.replyAllCommand();
|
||||
|
|
@ -515,7 +511,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
// print
|
||||
shortcuts.add('p,printscreen', 'meta', [Scope.MessageView, Scope.MessageList], () => {
|
||||
this.message() && this.message().printMessage();
|
||||
MessageUserStore.message() && MessageUserStore.message().printMessage();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
@ -531,7 +527,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
// change focused state
|
||||
shortcuts.add('arrowleft', '', Scope.MessageView, () => {
|
||||
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
|
||||
if (!this.fullScreenMode() && MessageUserStore.message() && SettingsUserStore.usePreviewPane()) {
|
||||
if (this.oMessageScrollerDom && 0 < this.oMessageScrollerDom.scrollLeft) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -540,7 +536,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
});
|
||||
shortcuts.add('tab', 'shift', Scope.MessageView, () => {
|
||||
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
|
||||
if (!this.fullScreenMode() && MessageUserStore.message() && SettingsUserStore.usePreviewPane()) {
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -623,7 +619,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
downloadAsZip() {
|
||||
const hashes = (this.message() ? this.message().attachments : [])
|
||||
const hashes = (MessageUserStore.message() ? MessageUserStore.message().attachments : [])
|
||||
.map(item => (item && !item.isLinked && item.checked() ? item.download : ''))
|
||||
.filter(v => v);
|
||||
if (hashes.length) {
|
||||
|
|
@ -647,10 +643,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
* @param {MessageModel} oMessage
|
||||
* @returns {void}
|
||||
*/
|
||||
showImages(message) {
|
||||
if (message && message.showExternalImages) {
|
||||
message.showExternalImages();
|
||||
}
|
||||
showImages() {
|
||||
MessageUserStore.message() && MessageUserStore.message().showExternalImages();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -665,7 +659,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
* @param {MessageModel} oMessage
|
||||
* @returns {void}
|
||||
*/
|
||||
readReceipt(oMessage) {
|
||||
readReceipt() {
|
||||
let oMessage = MessageUserStore.message()
|
||||
if (oMessage && oMessage.readReceipt()) {
|
||||
Remote.sendReadReceiptMessage(
|
||||
()=>{},
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@
|
|||
</div>
|
||||
<div data-bind="visible: allowMessageActions" class="dividerbar">
|
||||
<li class="e-item" role="presentation">
|
||||
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="click: function () { if (message()) { message().printMessage(); }} ">
|
||||
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="click: function () { message() && message().printMessage(); } ">
|
||||
<i class="fontastic">🖨</i>
|
||||
<span data-i18n="MESSAGE/MENU_PRINT"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="e-item" role="presentation">
|
||||
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="click: function () { if (message()) { message().viewPopupMessage(); }}">
|
||||
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="click: function () { message() && message().viewPopupMessage(); }">
|
||||
<i class="icon-popup"></i>
|
||||
<span data-i18n="MESSAGE/BUTTON_IN_NEW_WINDOW"></span>
|
||||
</a>
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="messageItem fixIndex" data-bind="css: viewLineAsCss(), attr: {'style': 'top:' + viewBodyTopValue() + 'px' }">
|
||||
<div tabindex="0" data-bind="hasfocus: messageDomFocused, css: { 'focused': messageDomFocused }">
|
||||
<div tabindex="0" data-bind="hasfocus: messageDomFocused">
|
||||
|
||||
<div>
|
||||
<span class="buttonFull" data-bind="click: toggleFullScreen">
|
||||
|
|
@ -260,11 +260,11 @@
|
|||
|
||||
<div class="g-ui-min-height-300" data-bind="visible: !messageLoadingThrottle()">
|
||||
<div class="bodySubHeader">
|
||||
<div class="showImages" data-bind="visible: message() && message().hasImages(), click: function() { showImages(message()); }">
|
||||
<div class="showImages" data-bind="visible: message() && message().hasImages(), click: showImages">
|
||||
<i class="fontastic">🖼</i>
|
||||
<span class="text" data-i18n="MESSAGE/BUTTON_SHOW_IMAGES"></span>
|
||||
</div>
|
||||
<div class="readReceipt" data-bind="visible: message() && !isDraftOrSentFolder() && '' !== message().readReceipt() && !message().isReadReceipt(), click: function() { readReceipt(message()); }">
|
||||
<div class="readReceipt" data-bind="visible: message() && !isDraftOrSentFolder() && '' !== message().readReceipt() && !message().isReadReceipt(), click: readReceipt">
|
||||
<i class="icon-mail"></i>
|
||||
<span class="text" data-i18n="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@
|
|||
</div>
|
||||
|
||||
<div class="attachmentAreaParent b-content" data-bind="visible: attachmentsPlace">
|
||||
<div class="b-attachment-place" data-bind="visible: addAttachmentEnabled() && dragAndDropEnabled() && dragAndDropVisible(), initDom: composeUploaderDropPlace, css: {'dragAndDropOver': dragAndDropOver}"
|
||||
<div class="b-attachment-place" data-bind="visible: addAttachmentEnabled() && dragAndDropVisible(), initDom: composeUploaderDropPlace, css: {'dragAndDropOver': dragAndDropOver}"
|
||||
data-i18n="COMPOSE/ATTACH_DROP_FILES_DESC"></div>
|
||||
<ul class="attachmentList" data-bind="foreach: attachments">
|
||||
<li class="attachmentItem" data-bind="attr: { 'title': title }, css: { 'waiting': waiting, 'error': '' !== error() }">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue