mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +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);
|
setTimeout(() => $htmlCL.add('rl-started-delay'), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function decorateKoCommands(thisArg, commands) {
|
export function decorateKoCommands(thisArg, commands) {
|
||||||
Object.entries(commands).forEach(([key, canExecute]) => {
|
Object.entries(commands).forEach(([key, canExecute]) => {
|
||||||
let command = thisArg[key],
|
let command = thisArg[key],
|
||||||
fn = (...args) => fn.enabled() && fn.canExecute() && command.apply(thisArg, args);
|
fn = (...args) => fn.enabled() && fn.canExecute() && command.apply(thisArg, args);
|
||||||
|
|
@ -330,29 +330,3 @@ function decorateKoCommands(thisArg, commands) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ko.decorateCommands = decorateKoCommands;
|
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()) {
|
if (this.background.uploaderButton() && this.capaUserBackground()) {
|
||||||
const oJua = new Jua({
|
const oJua = new Jua({
|
||||||
action: serverRequest('UploadBackground'),
|
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,
|
composeUploaderButton: null,
|
||||||
composeUploaderDropPlace: null,
|
composeUploaderDropPlace: null,
|
||||||
dragAndDropEnabled: false,
|
|
||||||
attacheMultipleAllowed: false,
|
attacheMultipleAllowed: false,
|
||||||
addAttachmentEnabled: false,
|
addAttachmentEnabled: false,
|
||||||
|
|
||||||
|
|
@ -1090,97 +1089,8 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
this.initUploader();
|
// initUploader
|
||||||
|
|
||||||
shortcuts.add('q', 'meta', Scope.Compose, ()=>false);
|
|
||||||
shortcuts.add('w', 'meta', Scope.Compose, ()=>false);
|
|
||||||
|
|
||||||
shortcuts.add('m,contextmenu', '', Scope.Compose, e => this.popupMenu(e));
|
|
||||||
shortcuts.add('m', 'ctrl', Scope.Compose, e => this.popupMenu(e));
|
|
||||||
|
|
||||||
shortcuts.add('escape,close', '', Scope.Compose, () => {
|
|
||||||
this.skipCommand();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
shortcuts.add('arrowdown', 'meta', Scope.Compose, () => {
|
|
||||||
this.skipCommand();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
shortcuts.add('s', 'meta', Scope.Compose, () => {
|
|
||||||
this.saveCommand();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
shortcuts.add('save', Scope.Compose, () => {
|
|
||||||
this.saveCommand();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Settings.app('allowCtrlEnterOnCompose')) {
|
|
||||||
shortcuts.add('enter', 'meta', Scope.Compose, () => {
|
|
||||||
this.sendCommand();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
shortcuts.add('mailsend', '', Scope.Compose, () => {
|
|
||||||
this.sendCommand();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
shortcuts.add('escape,close', 'shift', Scope.Compose, () => {
|
|
||||||
this.modalVisibility() && this.tryToClosePopup();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
const ro = this.resizeObserver;
|
|
||||||
ro.compose = dom.querySelector('.b-compose');
|
|
||||||
ro.header = dom.querySelector('.b-header');
|
|
||||||
ro.toolbar = dom.querySelector('.b-header-toolbar');
|
|
||||||
ro.els = [dom.querySelector('.textAreaParent'), dom.querySelector('.attachmentAreaParent')];
|
|
||||||
|
|
||||||
this.editor(editor => editor.modeWysiwyg());
|
|
||||||
|
|
||||||
// Fullscreen must be on app, else other popups fail
|
|
||||||
const el = doc.getElementById('rl-app');
|
|
||||||
let event = 'fullscreenchange';
|
|
||||||
if (!el.requestFullscreen && el.webkitRequestFullscreen) {
|
|
||||||
el.requestFullscreen = el.webkitRequestFullscreen;
|
|
||||||
event = 'webkit' + event;
|
|
||||||
}
|
|
||||||
if (el.requestFullscreen) {
|
|
||||||
if (!doc.exitFullscreen && doc.webkitExitFullscreen) {
|
|
||||||
doc.exitFullscreen = doc.webkitExitFullscreen;
|
|
||||||
}
|
|
||||||
this.oContent = el;
|
|
||||||
el.addEventListener(event, () =>
|
|
||||||
ThemeStore.isMobile()
|
|
||||||
&& this.modalVisibility()
|
|
||||||
&& (doc.fullscreenElement || doc.webkitFullscreenElement) !== el
|
|
||||||
&& this.skipCommand()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} id
|
|
||||||
* @returns {?Object}
|
|
||||||
*/
|
|
||||||
getAttachmentById(id) {
|
|
||||||
return this.attachments.find(item => item && id === item.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancelAttachmentHelper(id, oJua) {
|
|
||||||
return () => {
|
|
||||||
const attachment = this.getAttachmentById(id);
|
|
||||||
if (attachment) {
|
|
||||||
this.attachments.remove(attachment);
|
|
||||||
delegateRunOnDestroy(attachment);
|
|
||||||
oJua && oJua.cancel(id);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
initUploader() {
|
|
||||||
if (this.composeUploaderButton()) {
|
if (this.composeUploaderButton()) {
|
||||||
const uploadCache = {},
|
const uploadCache = {},
|
||||||
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
|
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
|
||||||
|
|
@ -1193,7 +1103,6 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
dragAndDropElement: this.composeUploaderDropPlace()
|
dragAndDropElement: this.composeUploaderDropPlace()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oJua) {
|
|
||||||
oJua
|
oJua
|
||||||
// .on('onLimitReached', (limit) => {
|
// .on('onLimitReached', (limit) => {
|
||||||
// alert(limit);
|
// alert(limit);
|
||||||
|
|
@ -1299,11 +1208,95 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addAttachmentEnabled(true).dragAndDropEnabled(true);
|
this.addAttachmentEnabled(true);
|
||||||
} else {
|
}
|
||||||
this.addAttachmentEnabled(false).dragAndDropEnabled(false);
|
|
||||||
|
shortcuts.add('q', 'meta', Scope.Compose, ()=>false);
|
||||||
|
shortcuts.add('w', 'meta', Scope.Compose, ()=>false);
|
||||||
|
|
||||||
|
shortcuts.add('m,contextmenu', '', Scope.Compose, e => this.popupMenu(e));
|
||||||
|
shortcuts.add('m', 'ctrl', Scope.Compose, e => this.popupMenu(e));
|
||||||
|
|
||||||
|
shortcuts.add('escape,close', '', Scope.Compose, () => {
|
||||||
|
this.skipCommand();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
shortcuts.add('arrowdown', 'meta', Scope.Compose, () => {
|
||||||
|
this.skipCommand();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
shortcuts.add('s', 'meta', Scope.Compose, () => {
|
||||||
|
this.saveCommand();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
shortcuts.add('save', Scope.Compose, () => {
|
||||||
|
this.saveCommand();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Settings.app('allowCtrlEnterOnCompose')) {
|
||||||
|
shortcuts.add('enter', 'meta', Scope.Compose, () => {
|
||||||
|
this.sendCommand();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
shortcuts.add('mailsend', '', Scope.Compose, () => {
|
||||||
|
this.sendCommand();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
shortcuts.add('escape,close', 'shift', Scope.Compose, () => {
|
||||||
|
this.modalVisibility() && this.tryToClosePopup();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
const ro = this.resizeObserver;
|
||||||
|
ro.compose = dom.querySelector('.b-compose');
|
||||||
|
ro.header = dom.querySelector('.b-header');
|
||||||
|
ro.toolbar = dom.querySelector('.b-header-toolbar');
|
||||||
|
ro.els = [dom.querySelector('.textAreaParent'), dom.querySelector('.attachmentAreaParent')];
|
||||||
|
|
||||||
|
this.editor(editor => editor.modeWysiwyg());
|
||||||
|
|
||||||
|
// Fullscreen must be on app, else other popups fail
|
||||||
|
const el = doc.getElementById('rl-app');
|
||||||
|
let event = 'fullscreenchange';
|
||||||
|
if (!el.requestFullscreen && el.webkitRequestFullscreen) {
|
||||||
|
el.requestFullscreen = el.webkitRequestFullscreen;
|
||||||
|
event = 'webkit' + event;
|
||||||
|
}
|
||||||
|
if (el.requestFullscreen) {
|
||||||
|
if (!doc.exitFullscreen && doc.webkitExitFullscreen) {
|
||||||
|
doc.exitFullscreen = doc.webkitExitFullscreen;
|
||||||
|
}
|
||||||
|
this.oContent = el;
|
||||||
|
el.addEventListener(event, () =>
|
||||||
|
ThemeStore.isMobile()
|
||||||
|
&& this.modalVisibility()
|
||||||
|
&& (doc.fullscreenElement || doc.webkitFullscreenElement) !== el
|
||||||
|
&& this.skipCommand()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} id
|
||||||
|
* @returns {?Object}
|
||||||
|
*/
|
||||||
|
getAttachmentById(id) {
|
||||||
|
return this.attachments.find(item => item && id === item.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelAttachmentHelper(id, oJua) {
|
||||||
|
return () => {
|
||||||
|
const attachment = this.getAttachmentById(id);
|
||||||
|
if (attachment) {
|
||||||
|
this.attachments.remove(attachment);
|
||||||
|
delegateRunOnDestroy(attachment);
|
||||||
|
oJua && oJua.cancel(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -324,32 +324,6 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
rl.app.download(serverRequestRaw('ContactsCsv'));
|
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() {
|
removeCheckedOrSelectedContactsFromList() {
|
||||||
const contacts = this.contactsCheckedOrSelected();
|
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) {
|
onShow(bBackToCompose, sLastComposeFocusedField) {
|
||||||
|
|
|
||||||
|
|
@ -706,15 +706,41 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
el && this.gotoThread(ko.dataFor(el));
|
el && this.gotoThread(ko.dataFor(el));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.initUploaderForAppend();
|
// initUploaderForAppend
|
||||||
this.initShortcuts();
|
|
||||||
|
|
||||||
if (!ThemeStore.isMobile() && Settings.capa(Capa.Prefetch)) {
|
if (Settings.app('allowAppendMessage') && this.dragOverArea()) {
|
||||||
ifvisible.idle(this.prefetchNextTick.bind(this));
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
initShortcuts() {
|
return false;
|
||||||
|
})
|
||||||
|
.on('onComplete', () => rl.app.reloadMessageList(true, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// initShortcuts
|
||||||
|
|
||||||
shortcuts.add('enter,open', '', Scope.MessageList, () => {
|
shortcuts.add('enter,open', '', Scope.MessageList, () => {
|
||||||
if (MessageUserStore.message() && this.useAutoSelect()) {
|
if (MessageUserStore.message() && this.useAutoSelect()) {
|
||||||
dispatchEvent(new CustomEvent('mailbox.message-view.toggle-full-screen'));
|
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('arrowleft', 'meta', Scope.MessageView, ()=>false);
|
||||||
shortcuts.add('arrowright', '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() {
|
prefetchNextTick() {
|
||||||
|
|
@ -894,41 +924,4 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
LIMIT: FileInfo.friendlySize(QuotaUserStore.quota())
|
LIMIT: FileInfo.friendlySize(QuotaUserStore.quota())
|
||||||
}).replace(/<[^>]+>/g, '');
|
}).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) =>
|
createCommandActionHelper = (folderType, useFolder) =>
|
||||||
createCommand(() => {
|
createCommand(() => {
|
||||||
const message = this.message();
|
const message = MessageUserStore.message();
|
||||||
if (message && this.allowMessageListActions) {
|
if (message && this.allowMessageListActions) {
|
||||||
this.message(null);
|
MessageUserStore.message(null);
|
||||||
rl.app.deleteMessagesFromFolder(folderType, message.folder, [message.uid], useFolder);
|
rl.app.deleteMessagesFromFolder(folderType, message.folder, [message.uid], useFolder);
|
||||||
}
|
}
|
||||||
}, this.messageVisibility);
|
}, this.messageVisibility);
|
||||||
|
|
@ -84,9 +84,6 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
|
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
|
||||||
this.messageLoadingThrottle = MessageUserStore.messageLoading;
|
this.messageLoadingThrottle = MessageUserStore.messageLoading;
|
||||||
this.messagesBodiesDom = MessageUserStore.messagesBodiesDom;
|
this.messagesBodiesDom = MessageUserStore.messagesBodiesDom;
|
||||||
this.useThreads = SettingsUserStore.useThreads;
|
|
||||||
this.replySameFolder = SettingsUserStore.replySameFolder;
|
|
||||||
this.layout = SettingsUserStore.layout;
|
|
||||||
this.isMessageSelected = MessageUserStore.isMessageSelected;
|
this.isMessageSelected = MessageUserStore.isMessageSelected;
|
||||||
this.messageActiveDom = MessageUserStore.messageActiveDom;
|
this.messageActiveDom = MessageUserStore.messageActiveDom;
|
||||||
this.messageError = MessageUserStore.messageError;
|
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(),
|
canBeRepliedOrForwarded: () => !this.isDraftFolder() && this.messageVisibility(),
|
||||||
|
|
||||||
|
|
@ -190,8 +187,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addSubscribables({
|
this.addSubscribables({
|
||||||
showAttachmnetControls: v => this.message()
|
showAttachmnetControls: v => MessageUserStore.message()
|
||||||
&& this.message().attachments.forEach(item => item && item.checked(!!v)),
|
&& MessageUserStore.message().attachments.forEach(item => item && item.checked(!!v)),
|
||||||
|
|
||||||
lastReplyAction_: value => Local.set(ClientSideKeyName.LastReplyAction, value),
|
lastReplyAction_: value => Local.set(ClientSideKeyName.LastReplyAction, value),
|
||||||
|
|
||||||
|
|
@ -253,7 +250,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
|
|
||||||
MessageUserStore.messageViewTrigger.subscribe(() => {
|
MessageUserStore.messageViewTrigger.subscribe(() => {
|
||||||
const message = this.message();
|
const message = MessageUserStore.message();
|
||||||
this.viewIsFlagged(message ? message.isFlagged() : false);
|
this.viewIsFlagged(message ? message.isFlagged() : false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -279,13 +276,13 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
goUpCommand() {
|
goUpCommand() {
|
||||||
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-up',
|
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-up',
|
||||||
{detail:SettingsUserStore.usePreviewPane() || !!this.message()} // bForceSelect
|
{detail:SettingsUserStore.usePreviewPane() || !!MessageUserStore.message()} // bForceSelect
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
goDownCommand() {
|
goDownCommand() {
|
||||||
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-down',
|
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() {
|
checkHeaderHeight() {
|
||||||
this.oHeaderDom && this.viewBodyTopValue(this.message() ? this.oHeaderDom.offsetHeight : 0);
|
this.oHeaderDom && this.viewBodyTopValue(MessageUserStore.message() ? this.oHeaderDom.offsetHeight : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild(dom) {
|
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'));
|
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')) {
|
if (eqs(event, '.messageItemHeader .subjectParent .flagParent')) {
|
||||||
const message = this.message();
|
const message = MessageUserStore.message();
|
||||||
message && rl.app.messageListAction(
|
message && rl.app.messageListAction(
|
||||||
message.folder,
|
message.folder,
|
||||||
message.isFlagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
message.isFlagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
||||||
|
|
@ -418,13 +416,11 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
this.oMessageScrollerDom = dom.querySelector('.messageItem');
|
this.oMessageScrollerDom = dom.querySelector('.messageItem');
|
||||||
|
|
||||||
this.initShortcuts();
|
// initShortcuts
|
||||||
}
|
|
||||||
|
|
||||||
initShortcuts() {
|
|
||||||
// exit fullscreen, back
|
// exit fullscreen, back
|
||||||
shortcuts.add('escape,backspace', '', Scope.MessageView, () => {
|
shortcuts.add('escape,backspace', '', Scope.MessageView, () => {
|
||||||
if (this.viewModelVisible && this.message()) {
|
if (this.viewModelVisible && MessageUserStore.message()) {
|
||||||
const preview = SettingsUserStore.usePreviewPane();
|
const preview = SettingsUserStore.usePreviewPane();
|
||||||
if (this.fullScreenMode()) {
|
if (this.fullScreenMode()) {
|
||||||
this.fullScreenMode(false);
|
this.fullScreenMode(false);
|
||||||
|
|
@ -433,7 +429,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(Scope.MessageList);
|
||||||
}
|
}
|
||||||
} else if (!preview) {
|
} else if (!preview) {
|
||||||
this.message(null);
|
MessageUserStore.message(null);
|
||||||
} else {
|
} else {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(Scope.MessageList);
|
||||||
}
|
}
|
||||||
|
|
@ -459,7 +455,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// replaAll
|
// replyAll
|
||||||
shortcuts.add('a', '', [Scope.MessageList, Scope.MessageView], () => {
|
shortcuts.add('a', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||||
if (MessageUserStore.message()) {
|
if (MessageUserStore.message()) {
|
||||||
this.replyAllCommand();
|
this.replyAllCommand();
|
||||||
|
|
@ -515,7 +511,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
// print
|
// print
|
||||||
shortcuts.add('p,printscreen', 'meta', [Scope.MessageView, Scope.MessageList], () => {
|
shortcuts.add('p,printscreen', 'meta', [Scope.MessageView, Scope.MessageList], () => {
|
||||||
this.message() && this.message().printMessage();
|
MessageUserStore.message() && MessageUserStore.message().printMessage();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -531,7 +527,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
// change focused state
|
// change focused state
|
||||||
shortcuts.add('arrowleft', '', Scope.MessageView, () => {
|
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) {
|
if (this.oMessageScrollerDom && 0 < this.oMessageScrollerDom.scrollLeft) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -540,7 +536,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
shortcuts.add('tab', 'shift', Scope.MessageView, () => {
|
shortcuts.add('tab', 'shift', Scope.MessageView, () => {
|
||||||
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
|
if (!this.fullScreenMode() && MessageUserStore.message() && SettingsUserStore.usePreviewPane()) {
|
||||||
AppUserStore.focusedState(Scope.MessageList);
|
AppUserStore.focusedState(Scope.MessageList);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -623,7 +619,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadAsZip() {
|
downloadAsZip() {
|
||||||
const hashes = (this.message() ? this.message().attachments : [])
|
const hashes = (MessageUserStore.message() ? MessageUserStore.message().attachments : [])
|
||||||
.map(item => (item && !item.isLinked && item.checked() ? item.download : ''))
|
.map(item => (item && !item.isLinked && item.checked() ? item.download : ''))
|
||||||
.filter(v => v);
|
.filter(v => v);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
|
|
@ -647,10 +643,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
showImages(message) {
|
showImages() {
|
||||||
if (message && message.showExternalImages) {
|
MessageUserStore.message() && MessageUserStore.message().showExternalImages();
|
||||||
message.showExternalImages();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -665,7 +659,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
readReceipt(oMessage) {
|
readReceipt() {
|
||||||
|
let oMessage = MessageUserStore.message()
|
||||||
if (oMessage && oMessage.readReceipt()) {
|
if (oMessage && oMessage.readReceipt()) {
|
||||||
Remote.sendReadReceiptMessage(
|
Remote.sendReadReceiptMessage(
|
||||||
()=>{},
|
()=>{},
|
||||||
|
|
|
||||||
|
|
@ -129,13 +129,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="visible: allowMessageActions" class="dividerbar">
|
<div data-bind="visible: allowMessageActions" class="dividerbar">
|
||||||
<li class="e-item" role="presentation">
|
<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>
|
<i class="fontastic">🖨</i>
|
||||||
<span data-i18n="MESSAGE/MENU_PRINT"></span>
|
<span data-i18n="MESSAGE/MENU_PRINT"></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="e-item" role="presentation">
|
<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>
|
<i class="icon-popup"></i>
|
||||||
<span data-i18n="MESSAGE/BUTTON_IN_NEW_WINDOW"></span>
|
<span data-i18n="MESSAGE/BUTTON_IN_NEW_WINDOW"></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -244,7 +244,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="messageItem fixIndex" data-bind="css: viewLineAsCss(), attr: {'style': 'top:' + viewBodyTopValue() + 'px' }">
|
<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>
|
<div>
|
||||||
<span class="buttonFull" data-bind="click: toggleFullScreen">
|
<span class="buttonFull" data-bind="click: toggleFullScreen">
|
||||||
|
|
@ -260,11 +260,11 @@
|
||||||
|
|
||||||
<div class="g-ui-min-height-300" data-bind="visible: !messageLoadingThrottle()">
|
<div class="g-ui-min-height-300" data-bind="visible: !messageLoadingThrottle()">
|
||||||
<div class="bodySubHeader">
|
<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>
|
<i class="fontastic">🖼</i>
|
||||||
<span class="text" data-i18n="MESSAGE/BUTTON_SHOW_IMAGES"></span>
|
<span class="text" data-i18n="MESSAGE/BUTTON_SHOW_IMAGES"></span>
|
||||||
</div>
|
</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>
|
<i class="icon-mail"></i>
|
||||||
<span class="text" data-i18n="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></span>
|
<span class="text" data-i18n="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="attachmentAreaParent b-content" data-bind="visible: attachmentsPlace">
|
<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>
|
data-i18n="COMPOSE/ATTACH_DROP_FILES_DESC"></div>
|
||||||
<ul class="attachmentList" data-bind="foreach: attachments">
|
<ul class="attachmentList" data-bind="foreach: attachments">
|
||||||
<li class="attachmentItem" data-bind="attr: { 'title': title }, css: { 'waiting': waiting, 'error': '' !== error() }">
|
<li class="attachmentItem" data-bind="attr: { 'title': title }, css: { 'waiting': waiting, 'error': '' !== error() }">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue