2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
|
|
|
|
|
|
|
import {
|
2021-03-16 23:06:16 +08:00
|
|
|
Scope,
|
2019-07-05 03:19:24 +08:00
|
|
|
Notification,
|
2016-08-17 06:01:20 +08:00
|
|
|
UploadErrorCode
|
|
|
|
} from 'Common/Enums';
|
|
|
|
|
2021-01-25 05:58:06 +08:00
|
|
|
import {
|
|
|
|
ComposeType,
|
|
|
|
EditorDefaultType,
|
|
|
|
SetSystemFoldersNotification
|
|
|
|
} from 'Common/EnumsUser';
|
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
import { inFocus, pInt, isArray, arrayLength } from 'Common/Utils';
|
2021-01-26 05:00:13 +08:00
|
|
|
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
2021-01-27 07:26:31 +08:00
|
|
|
import { encodeHtml, HtmlEditor } from 'Common/Html';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
2021-02-04 18:25:00 +08:00
|
|
|
import { serverRequest } from 'Common/Links';
|
2019-07-05 03:19:24 +08:00
|
|
|
import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator';
|
2021-01-27 07:26:31 +08:00
|
|
|
import { timestampToString } from 'Common/Momentor';
|
2020-10-25 20:50:26 +08:00
|
|
|
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
|
2021-07-16 03:01:41 +08:00
|
|
|
import { doc, Settings, SettingsGet } from 'Common/Globals';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-03-11 05:41:35 +08:00
|
|
|
import { AppUserStore } from 'Stores/User/App';
|
|
|
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
2021-02-17 21:40:21 +08:00
|
|
|
import { IdentityUserStore } from 'Stores/User/Identity';
|
2021-03-11 05:41:35 +08:00
|
|
|
import { AccountUserStore } from 'Stores/User/Account';
|
|
|
|
import { FolderUserStore } from 'Stores/User/Folder';
|
|
|
|
import { PgpUserStore } from 'Stores/User/Pgp';
|
|
|
|
import { MessageUserStore } from 'Stores/User/Message';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-09-15 01:40:56 +08:00
|
|
|
import Remote from 'Remote/User/Fetch';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-02-19 19:09:20 +08:00
|
|
|
import { decorateKoCommands, isPopupVisible, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin';
|
2021-01-24 17:25:23 +08:00
|
|
|
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-01-26 05:00:13 +08:00
|
|
|
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
|
|
|
|
import { AskPopupView } from 'View/Popup/Ask';
|
|
|
|
import { ContactsPopupView } from 'View/Popup/Contacts';
|
|
|
|
import { ComposeOpenPgpPopupView } from 'View/Popup/ComposeOpenPgp';
|
|
|
|
|
2021-07-16 03:01:41 +08:00
|
|
|
import { ThemeStore } from 'Stores/Theme';
|
|
|
|
|
2021-01-27 07:26:31 +08:00
|
|
|
const
|
2020-10-03 05:54:15 +08:00
|
|
|
/**
|
|
|
|
* @param {string} prefix
|
|
|
|
* @param {string} subject
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
replySubjectAdd = (prefix, subject) => {
|
|
|
|
prefix = prefix.toUpperCase().trim();
|
2021-03-12 18:41:44 +08:00
|
|
|
subject = subject.replace(/\s+/g, ' ').trim();
|
2020-10-03 05:54:15 +08:00
|
|
|
|
|
|
|
let drop = false,
|
|
|
|
re = 'RE' === prefix,
|
|
|
|
fwd = 'FWD' === prefix;
|
|
|
|
|
|
|
|
const parts = [],
|
|
|
|
prefixIsRe = !fwd;
|
|
|
|
|
|
|
|
if (subject) {
|
|
|
|
subject.split(':').forEach(part => {
|
|
|
|
const trimmedPart = part.trim();
|
|
|
|
if (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[[(][\d]+[\])]$/i.test(trimmedPart))) {
|
|
|
|
if (!re) {
|
|
|
|
re = !!/^RE/i.test(trimmedPart);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!fwd) {
|
|
|
|
fwd = !!/^FWD/i.test(trimmedPart);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
parts.push(part);
|
|
|
|
drop = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prefixIsRe) {
|
|
|
|
re = false;
|
|
|
|
} else {
|
|
|
|
fwd = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ((prefixIsRe ? 'Re: ' : 'Fwd: ') + (re ? 'Re: ' : '')
|
|
|
|
+ (fwd ? 'Fwd: ' : '') + parts.join(':').trim()).trim();
|
|
|
|
};
|
2020-09-04 18:05:17 +08:00
|
|
|
|
2020-09-17 06:02:35 +08:00
|
|
|
ko.extenders.toggleSubscribe = (target, options) => {
|
|
|
|
target.subscribe(options[1], options[0], 'beforeChange');
|
|
|
|
target.subscribe(options[2], options[0]);
|
|
|
|
return target;
|
|
|
|
};
|
|
|
|
|
2021-01-24 17:25:23 +08:00
|
|
|
class ComposePopupView extends AbstractViewPopup {
|
2016-08-17 06:01:20 +08:00
|
|
|
constructor() {
|
2021-01-24 17:25:23 +08:00
|
|
|
super('Compose');
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
const fEmailOutInHelper = (context, identity, name, isIn) => {
|
|
|
|
if (identity && context && identity[name]() && (isIn ? true : context[name]())) {
|
|
|
|
const identityEmail = identity[name]();
|
2021-03-12 18:41:44 +08:00
|
|
|
let list = context[name]().trim().split(',');
|
2015-02-06 23:26:20 +08:00
|
|
|
|
2020-07-21 03:29:44 +08:00
|
|
|
list = list.filter(email => {
|
2020-08-07 00:24:46 +08:00
|
|
|
email = email.trim();
|
|
|
|
return email && identityEmail.trim() !== email;
|
2019-07-05 03:19:24 +08:00
|
|
|
});
|
2015-02-06 23:26:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (isIn) {
|
|
|
|
list.push(identityEmail);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2019-07-05 03:19:24 +08:00
|
|
|
|
|
|
|
context[name](list.join(','));
|
|
|
|
}
|
|
|
|
};
|
2015-02-01 03:00:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.oLastMessage = null;
|
|
|
|
this.oEditor = null;
|
|
|
|
this.aDraftInfo = null;
|
|
|
|
this.sInReplyTo = '';
|
|
|
|
this.bFromDraft = false;
|
|
|
|
this.sReferences = '';
|
2014-03-20 06:39:36 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sLastFocusedField = 'to';
|
2015-02-16 05:55:59 +08:00
|
|
|
|
2021-03-17 17:05:22 +08:00
|
|
|
this.allowContacts = AppUserStore.allowContacts();
|
2014-12-31 20:21:43 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.bSkipNextHide = false;
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2021-03-11 05:41:35 +08:00
|
|
|
this.capaOpenPGP = PgpUserStore.capaOpenPGP;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2021-02-17 21:40:21 +08:00
|
|
|
this.identities = IdentityUserStore;
|
2014-01-04 08:20:07 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.addObservables({
|
|
|
|
identitiesDropdownTrigger: false,
|
2015-02-16 05:55:59 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
to: '',
|
|
|
|
cc: '',
|
|
|
|
bcc: '',
|
|
|
|
replyTo: '',
|
2017-09-28 01:58:15 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
subject: '',
|
|
|
|
|
|
|
|
isHtml: false,
|
2015-02-06 23:26:20 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
requestDsn: false,
|
|
|
|
requestReadReceipt: false,
|
|
|
|
markAsImportant: false,
|
2015-08-31 02:12:51 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
sendError: false,
|
|
|
|
sendSuccessButSaveError: false,
|
|
|
|
savedError: false,
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
sendErrorDesc: '',
|
|
|
|
savedErrorDesc: '',
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
savedTime: 0,
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
emptyToError: false,
|
2016-04-29 04:32:54 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
attachmentsInProcessError: false,
|
|
|
|
attachmentsInErrorError: false,
|
2015-04-07 03:32:19 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
showCc: false,
|
|
|
|
showBcc: false,
|
|
|
|
showReplyTo: false,
|
2015-04-07 03:32:19 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
draftFolder: '',
|
|
|
|
draftUid: '',
|
|
|
|
sending: false,
|
|
|
|
saving: false,
|
2015-04-07 03:32:19 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
attachmentsPlace: false,
|
2015-04-07 03:32:19 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
composeUploaderButton: null,
|
|
|
|
composeUploaderDropPlace: null,
|
|
|
|
attacheMultipleAllowed: false,
|
|
|
|
addAttachmentEnabled: false,
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2021-03-12 18:41:44 +08:00
|
|
|
// div.textAreaParent
|
2020-10-26 19:54:03 +08:00
|
|
|
composeEditorArea: null,
|
2015-04-07 03:32:19 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
currentIdentity: this.identities()[0] ? this.identities()[0] : null
|
|
|
|
});
|
|
|
|
|
|
|
|
// this.to.subscribe((v) => console.log(v));
|
2013-12-13 07:23:47 +08:00
|
|
|
|
2021-02-01 21:34:24 +08:00
|
|
|
// Used by ko.bindingHandlers.emailsTags
|
|
|
|
this.to.focused = ko.observable(false);
|
|
|
|
this.to.focused.subscribe(value => value && (this.sLastFocusedField = 'to'));
|
|
|
|
this.cc.focused = ko.observable(false);
|
|
|
|
this.cc.focused.subscribe(value => value && (this.sLastFocusedField = 'cc'));
|
|
|
|
this.bcc.focused = ko.observable(false);
|
|
|
|
this.bcc.focused.subscribe(value => value && (this.sLastFocusedField = 'bcc'));
|
2015-02-01 03:00:10 +08:00
|
|
|
|
2021-01-22 19:23:20 +08:00
|
|
|
this.attachments = ko.observableArray();
|
2015-02-01 03:00:10 +08:00
|
|
|
|
2021-02-10 19:12:36 +08:00
|
|
|
this.dragAndDropOver = ko.observable(false).extend({ debounce: 1 });
|
|
|
|
this.dragAndDropVisible = ko.observable(false).extend({ debounce: 1 });
|
2015-01-05 03:30:07 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
this.currentIdentity.extend({
|
|
|
|
toggleSubscribe: [
|
|
|
|
this,
|
|
|
|
(identity) => {
|
|
|
|
fEmailOutInHelper(this, identity, 'bcc');
|
|
|
|
fEmailOutInHelper(this, identity, 'replyTo');
|
|
|
|
},
|
|
|
|
(identity) => {
|
|
|
|
fEmailOutInHelper(this, identity, 'bcc', true);
|
|
|
|
fEmailOutInHelper(this, identity, 'replyTo', true);
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
2015-01-05 03:30:07 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.bDisabeCloseOnEsc = true;
|
|
|
|
|
|
|
|
this.tryToClosePopup = this.tryToClosePopup.debounce(200);
|
|
|
|
|
|
|
|
this.iTimer = 0;
|
|
|
|
|
|
|
|
this.addComputables({
|
|
|
|
sendButtonSuccess: () => !this.sendError() && !this.sendSuccessButSaveError(),
|
|
|
|
|
|
|
|
savedTimeText: () =>
|
2021-03-25 04:26:40 +08:00
|
|
|
this.savedTime() ? i18n('COMPOSE/SAVED_TIME', { TIME: this.savedTime().format('LT') }) : '',
|
2020-10-26 19:54:03 +08:00
|
|
|
|
|
|
|
emptyToErrorTooltip: () => (this.emptyToError() ? i18n('COMPOSE/EMPTY_TO_ERROR_DESC') : ''),
|
|
|
|
|
|
|
|
attachmentsErrorTooltip: () => {
|
|
|
|
let result = '';
|
|
|
|
switch (true) {
|
|
|
|
case this.attachmentsInProcessError():
|
|
|
|
result = i18n('COMPOSE/ATTACHMENTS_UPLOAD_ERROR_DESC');
|
|
|
|
break;
|
|
|
|
case this.attachmentsInErrorError():
|
|
|
|
result = i18n('COMPOSE/ATTACHMENTS_ERROR_DESC');
|
|
|
|
break;
|
|
|
|
// no default
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
},
|
|
|
|
|
2021-01-22 19:23:20 +08:00
|
|
|
attachmentsInProcess: () => this.attachments.filter(item => item && !item.complete()),
|
|
|
|
attachmentsInError: () => this.attachments.filter(item => item && item.error()),
|
2020-10-26 19:54:03 +08:00
|
|
|
|
2021-01-22 19:23:20 +08:00
|
|
|
attachmentsCount: () => this.attachments.length,
|
|
|
|
attachmentsInErrorCount: () => this.attachmentsInError.length,
|
|
|
|
attachmentsInProcessCount: () => this.attachmentsInProcess.length,
|
2020-10-26 19:54:03 +08:00
|
|
|
isDraftFolderMessage: () => this.draftFolder() && this.draftUid(),
|
|
|
|
|
|
|
|
identitiesOptions: () =>
|
2021-02-17 21:40:21 +08:00
|
|
|
IdentityUserStore.map(item => ({
|
2021-03-25 04:26:40 +08:00
|
|
|
item: item,
|
|
|
|
optValue: item.id(),
|
|
|
|
optText: item.formattedName()
|
2020-10-26 19:54:03 +08:00
|
|
|
})),
|
|
|
|
|
|
|
|
currentIdentityView: () => {
|
|
|
|
const item = this.currentIdentity();
|
|
|
|
return item ? item.formattedName() : 'unknown';
|
|
|
|
},
|
|
|
|
|
|
|
|
canBeSentOrSaved: () => !this.sending() && !this.saving()
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.addSubscribables({
|
|
|
|
sendError: value => !value && this.sendErrorDesc(''),
|
|
|
|
|
|
|
|
savedError: value => !value && this.savedErrorDesc(''),
|
|
|
|
|
|
|
|
sendSuccessButSaveError: value => !value && this.savedErrorDesc(''),
|
|
|
|
|
|
|
|
cc: value => {
|
|
|
|
if (false === this.showCc() && value.length) {
|
|
|
|
this.showCc(true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
bcc: value => {
|
|
|
|
if (false === this.showBcc() && value.length) {
|
|
|
|
this.showBcc(true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
replyTo: value => {
|
|
|
|
if (false === this.showReplyTo() && value.length) {
|
|
|
|
this.showReplyTo(true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
attachmentsInErrorCount: value => {
|
|
|
|
if (0 === value) {
|
|
|
|
this.attachmentsInErrorError(false);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
to: value => {
|
|
|
|
if (this.emptyToError() && value.length) {
|
|
|
|
this.emptyToError(false);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
attachmentsInProcess: value => {
|
2021-07-22 03:34:17 +08:00
|
|
|
if (this.attachmentsInProcessError() && arrayLength(value)) {
|
2020-10-26 19:54:03 +08:00
|
|
|
this.attachmentsInProcessError(false);
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
});
|
2015-01-05 03:30:07 +08:00
|
|
|
|
2020-10-26 19:54:03 +08:00
|
|
|
this.resizeObserver = new ResizeObserver(this.resizerTrigger.throttle(50).bind(this));
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2021-02-19 19:09:20 +08:00
|
|
|
decorateKoCommands(this, {
|
|
|
|
sendCommand: self => self.canBeSentOrSaved(),
|
|
|
|
saveCommand: self => self.canBeSentOrSaved(),
|
|
|
|
deleteCommand: self => self.isDraftFolderMessage(),
|
|
|
|
skipCommand: self => self.canBeSentOrSaved(),
|
|
|
|
contactsCommand: self => self.allowContacts
|
|
|
|
});
|
2016-09-10 06:38:16 +08:00
|
|
|
}
|
2015-01-05 03:30:07 +08:00
|
|
|
|
2020-08-18 03:32:57 +08:00
|
|
|
getMessageRequestParams(sSaveFolder)
|
|
|
|
{
|
2021-03-12 18:41:44 +08:00
|
|
|
let TextIsHtml = this.oEditor.isHtml() ? 1 : 0,
|
|
|
|
Text = this.oEditor.getData(true);
|
|
|
|
if (TextIsHtml) {
|
|
|
|
let l;
|
|
|
|
do {
|
|
|
|
l = Text.length;
|
|
|
|
Text = Text
|
|
|
|
// Remove Microsoft Office styling
|
|
|
|
.replace(/(<[^>]+[;"'])\s*mso-[a-z-]+\s*:[^;"']+/gi, '$1')
|
|
|
|
// Remove hubspot data-hs- attributes
|
|
|
|
.replace(/(<[^>]+)\s+data-hs-[a-z-]+=("[^"]+"|'[^']+')/gi, '$1');
|
|
|
|
} while (l != Text.length)
|
|
|
|
}
|
2020-08-18 03:32:57 +08:00
|
|
|
return {
|
|
|
|
IdentityID: this.currentIdentity() ? this.currentIdentity().id() : '',
|
|
|
|
MessageFolder: this.draftFolder(),
|
|
|
|
MessageUid: this.draftUid(),
|
|
|
|
SaveFolder: sSaveFolder,
|
|
|
|
To: this.to(),
|
|
|
|
Cc: this.cc(),
|
|
|
|
Bcc: this.bcc(),
|
|
|
|
ReplyTo: this.replyTo(),
|
|
|
|
Subject: this.subject(),
|
2021-03-12 18:41:44 +08:00
|
|
|
TextIsHtml: TextIsHtml,
|
|
|
|
Text: Text,
|
2020-08-18 03:32:57 +08:00
|
|
|
DraftInfo: this.aDraftInfo,
|
|
|
|
InReplyTo: this.sInReplyTo,
|
|
|
|
References: this.sReferences,
|
|
|
|
MarkAsImportant: this.markAsImportant() ? 1 : 0,
|
|
|
|
Attachments: this.prepearAttachmentsForSendOrSave(),
|
|
|
|
// Only used at send, not at save:
|
|
|
|
Dsn: this.requestDsn() ? 1 : 0,
|
|
|
|
ReadReceiptRequest: this.requestReadReceipt() ? 1 : 0
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
sendCommand() {
|
2021-03-11 05:41:35 +08:00
|
|
|
let sSentFolder = FolderUserStore.sentFolder();
|
2015-04-10 16:17:49 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
this.attachmentsInProcessError(false);
|
|
|
|
this.attachmentsInErrorError(false);
|
|
|
|
this.emptyToError(false);
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-07-28 18:35:41 +08:00
|
|
|
if (this.attachmentsInProcess().length) {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.attachmentsInProcessError(true);
|
|
|
|
this.attachmentsPlace(true);
|
2020-07-28 18:35:41 +08:00
|
|
|
} else if (this.attachmentsInError().length) {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.attachmentsInErrorError(true);
|
|
|
|
this.attachmentsPlace(true);
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2020-08-18 03:32:57 +08:00
|
|
|
if (!this.to().trim() && !this.cc().trim() && !this.bcc().trim()) {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.emptyToError(true);
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (!this.emptyToError() && !this.attachmentsInErrorError() && !this.attachmentsInProcessError()) {
|
2021-03-11 05:41:35 +08:00
|
|
|
if (SettingsUserStore.replySameFolder()) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (
|
2021-07-22 03:34:17 +08:00
|
|
|
3 === arrayLength(this.aDraftInfo) &&
|
2020-08-18 03:57:56 +08:00
|
|
|
null != this.aDraftInfo[2] &&
|
2020-07-28 18:35:41 +08:00
|
|
|
this.aDraftInfo[2].length
|
2019-07-05 03:19:24 +08:00
|
|
|
) {
|
2016-09-10 06:38:16 +08:00
|
|
|
sSentFolder = this.aDraftInfo[2];
|
|
|
|
}
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-07-28 23:20:14 +08:00
|
|
|
if (!sSentFolder) {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Sent]);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.sendError(false);
|
|
|
|
this.sending(true);
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
if (3 === arrayLength(this.aDraftInfo)) {
|
2020-10-30 23:46:18 +08:00
|
|
|
const flagsCache = MessageFlagsCache.getFor(this.aDraftInfo[2], this.aDraftInfo[1]);
|
2019-07-05 03:19:24 +08:00
|
|
|
if (flagsCache) {
|
|
|
|
if ('forward' === this.aDraftInfo[0]) {
|
2016-09-10 06:38:16 +08:00
|
|
|
flagsCache[3] = true;
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2016-09-10 06:38:16 +08:00
|
|
|
flagsCache[2] = true;
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2020-10-25 20:50:26 +08:00
|
|
|
MessageFlagsCache.setFor(this.aDraftInfo[2], this.aDraftInfo[1], flagsCache);
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.reloadFlagsCurrentMessageListAndMessageFromCache();
|
2016-09-10 06:38:16 +08:00
|
|
|
setFolderHash(this.aDraftInfo[2], '');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sSentFolder = UNUSED_OPTION_VALUE === sSentFolder ? '' : sSentFolder;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
setFolderHash(this.draftFolder(), '');
|
|
|
|
setFolderHash(sSentFolder, '');
|
|
|
|
|
|
|
|
Remote.sendMessage(
|
2021-04-23 16:47:24 +08:00
|
|
|
(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 {
|
2021-07-16 03:01:41 +08:00
|
|
|
this.closeCommand();
|
2021-04-23 16:47:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
this.reloadDraftFolder();
|
|
|
|
},
|
2020-08-18 03:32:57 +08:00
|
|
|
this.getMessageRequestParams(sSentFolder)
|
2013-11-16 06:21:12 +08:00
|
|
|
);
|
|
|
|
}
|
2016-09-10 06:38:16 +08:00
|
|
|
}
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
saveCommand() {
|
2021-03-11 05:41:35 +08:00
|
|
|
if (FolderUserStore.draftFolderNotEnabled()) {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Draft]);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.savedError(false);
|
|
|
|
this.saving(true);
|
2014-07-10 22:44:45 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
this.autosaveStart();
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2021-03-11 05:41:35 +08:00
|
|
|
setFolderHash(FolderUserStore.draftFolder(), '');
|
2014-08-22 23:08:56 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
Remote.saveMessage(
|
2021-04-23 16:47:24 +08:00
|
|
|
(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();
|
|
|
|
},
|
2021-03-11 05:41:35 +08:00
|
|
|
this.getMessageRequestParams(FolderUserStore.draftFolder())
|
2016-09-10 06:38:16 +08:00
|
|
|
);
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
return true;
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
deleteCommand() {
|
2021-01-26 05:00:13 +08:00
|
|
|
if (!isPopupVisible(AskPopupView) && this.modalVisibility()) {
|
|
|
|
showScreenPopup(AskPopupView, [
|
2019-07-05 03:19:24 +08:00
|
|
|
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
|
|
|
|
() => {
|
|
|
|
if (this.modalVisibility()) {
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
|
2019-07-05 03:19:24 +08:00
|
|
|
hideScreenPopup(ComposePopupView);
|
|
|
|
}
|
2016-09-10 06:38:16 +08:00
|
|
|
}
|
2019-07-05 03:19:24 +08:00
|
|
|
]);
|
2016-09-10 06:38:16 +08:00
|
|
|
}
|
|
|
|
}
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
skipCommand() {
|
|
|
|
this.bSkipNextHide = true;
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (
|
|
|
|
this.modalVisibility() &&
|
|
|
|
!this.saving() &&
|
|
|
|
!this.sending() &&
|
2021-03-11 05:41:35 +08:00
|
|
|
!FolderUserStore.draftFolderNotEnabled() &&
|
|
|
|
SettingsUserStore.allowDraftAutosave()
|
2019-07-05 03:19:24 +08:00
|
|
|
) {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.saveCommand();
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
this.tryToClosePopup();
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-09-10 06:38:16 +08:00
|
|
|
contactsCommand() {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (this.allowContacts) {
|
2016-09-10 06:38:16 +08:00
|
|
|
this.skipCommand();
|
2020-07-23 02:28:25 +08:00
|
|
|
setTimeout(() => {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(ContactsPopupView, [true, this.sLastFocusedField]);
|
2020-08-14 04:58:41 +08:00
|
|
|
}, 200);
|
2016-09-10 06:38:16 +08:00
|
|
|
}
|
|
|
|
}
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
autosaveStart() {
|
2020-07-30 03:49:41 +08:00
|
|
|
clearTimeout(this.iTimer);
|
2021-03-17 17:03:57 +08:00
|
|
|
this.iTimer = setTimeout(()=>{
|
|
|
|
if (this.modalVisibility()
|
|
|
|
&& !FolderUserStore.draftFolderNotEnabled()
|
|
|
|
&& SettingsUserStore.allowDraftAutosave()
|
|
|
|
&& !this.isEmptyForm(false)
|
|
|
|
&& !this.saving()
|
|
|
|
&& !this.sending()
|
|
|
|
&& !this.savedError()
|
|
|
|
) {
|
|
|
|
this.saveCommand();
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2021-03-17 17:03:57 +08:00
|
|
|
this.autosaveStart();
|
|
|
|
}, 60000);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-08-22 23:08:56 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
emailsSource(oData, fResponse) {
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.getAutocomplete(oData.term, aData => fResponse(aData.map(oEmailItem => oEmailItem.toLine(false))));
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
openOpenPgpPopup() {
|
2021-03-12 18:41:44 +08:00
|
|
|
if (PgpUserStore.capaOpenPGP() && !this.oEditor.isHtml()) {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(ComposeOpenPgpPopupView, [
|
2021-02-02 19:23:32 +08:00
|
|
|
result => this.editor(editor => editor.setPlain(result)),
|
2016-08-17 06:01:20 +08:00
|
|
|
this.oEditor.getData(false),
|
|
|
|
this.currentIdentity(),
|
|
|
|
this.to(),
|
|
|
|
this.cc(),
|
|
|
|
this.bcc()
|
|
|
|
]);
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
reloadDraftFolder() {
|
2021-03-11 05:41:35 +08:00
|
|
|
const draftFolder = FolderUserStore.draftFolder();
|
2020-07-28 23:20:14 +08:00
|
|
|
if (draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
|
2016-08-17 06:01:20 +08:00
|
|
|
setFolderHash(draftFolder, '');
|
2021-03-11 05:41:35 +08:00
|
|
|
if (FolderUserStore.currentFolderFullNameRaw() === draftFolder) {
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.reloadMessageList(true);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2020-09-15 15:29:25 +08:00
|
|
|
rl.app.folderInformation(draftFolder);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-03-20 00:18:28 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
findIdentityByMessage(composeType, message) {
|
2019-07-05 03:19:24 +08:00
|
|
|
let resultIndex = 1000,
|
2016-08-17 06:01:20 +08:00
|
|
|
resultIdentity = null;
|
2021-02-17 21:40:21 +08:00
|
|
|
const identities = IdentityUserStore(),
|
2016-08-17 06:01:20 +08:00
|
|
|
identitiesCache = {},
|
|
|
|
fEachHelper = (item) => {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (item && item.email && identitiesCache[item.email]) {
|
|
|
|
if (!resultIdentity || resultIndex > identitiesCache[item.email][1]) {
|
2016-08-17 06:01:20 +08:00
|
|
|
resultIdentity = identitiesCache[item.email][0];
|
|
|
|
resultIndex = identitiesCache[item.email][1];
|
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
};
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
identities.forEach((item, index) => identitiesCache[item.email()] = [item, index]);
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (message) {
|
|
|
|
switch (composeType) {
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Empty:
|
|
|
|
break;
|
|
|
|
case ComposeType.Reply:
|
|
|
|
case ComposeType.ReplyAll:
|
|
|
|
case ComposeType.Forward:
|
|
|
|
case ComposeType.ForwardAsAttachment:
|
2020-07-23 22:06:16 +08:00
|
|
|
message.to.concat(message.cc, message.bcc).forEach(fEachHelper);
|
2016-08-17 06:01:20 +08:00
|
|
|
if (!resultIdentity) {
|
2020-07-22 20:49:18 +08:00
|
|
|
message.deliveredTo.forEach(fEachHelper);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ComposeType.Draft:
|
2020-07-23 22:06:16 +08:00
|
|
|
message.from.concat(message.replyTo).forEach(fEachHelper);
|
2016-08-17 06:01:20 +08:00
|
|
|
break;
|
|
|
|
// no default
|
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return resultIdentity || identities[0] || null;
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
selectIdentity(identity) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity && identity.item) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.currentIdentity(identity.item);
|
|
|
|
this.setSignatureFromIdentity(identity.item);
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onHide() {
|
2021-03-17 17:03:57 +08:00
|
|
|
// Stop autosave
|
|
|
|
clearTimeout(this.iTimer);
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2021-03-17 17:03:57 +08:00
|
|
|
AppUserStore.composeInEdit(this.bSkipNextHide);
|
|
|
|
|
|
|
|
this.bSkipNextHide || this.reset();
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.bSkipNextHide = false;
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2021-02-01 21:34:24 +08:00
|
|
|
this.to.focused(false);
|
2015-03-21 06:22:06 +08:00
|
|
|
|
2020-09-17 02:35:29 +08:00
|
|
|
rl.route.on();
|
2020-08-19 17:30:31 +08:00
|
|
|
|
|
|
|
this.resizeObserver.disconnect();
|
2021-07-16 03:01:41 +08:00
|
|
|
|
|
|
|
(doc.fullscreenElement || doc.webkitFullscreenElement) === this.oContent && doc.exitFullscreen();
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
editor(fOnInit) {
|
2021-03-12 18:41:44 +08:00
|
|
|
if (fOnInit && this.composeEditorArea()) {
|
|
|
|
if (this.oEditor) {
|
|
|
|
fOnInit(this.oEditor);
|
|
|
|
} else {
|
2020-07-23 02:28:25 +08:00
|
|
|
// setTimeout(() => {
|
2019-07-05 03:19:24 +08:00
|
|
|
this.oEditor = new HtmlEditor(
|
|
|
|
this.composeEditorArea(),
|
|
|
|
null,
|
2020-09-09 23:03:44 +08:00
|
|
|
() => fOnInit(this.oEditor),
|
|
|
|
bHtml => this.isHtml(!!bHtml)
|
2019-07-05 03:19:24 +08:00
|
|
|
);
|
2017-06-25 03:26:27 +08:00
|
|
|
// }, 1000);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
}
|
2014-02-07 07:22:39 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
convertSignature(signature) {
|
2020-08-15 02:35:39 +08:00
|
|
|
let fromLine = this.oLastMessage ? this.emailArrayToStringLineHelper(this.oLastMessage.from, true) : '';
|
2020-07-28 23:20:14 +08:00
|
|
|
if (fromLine) {
|
2016-08-17 06:01:20 +08:00
|
|
|
signature = signature.replace(/{{FROM-FULL}}/g, fromLine);
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2020-07-21 03:39:00 +08:00
|
|
|
if (!fromLine.includes(' ') && 0 < fromLine.indexOf('@')) {
|
2021-03-12 18:41:44 +08:00
|
|
|
fromLine = fromLine.replace(/@\S+/, '');
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
signature = signature.replace(/{{FROM}}/g, fromLine);
|
|
|
|
}
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
return signature
|
2021-03-12 18:41:44 +08:00
|
|
|
.replace(/\r/g, '')
|
|
|
|
.replace(/\s{1,2}?{{FROM}}/g, '')
|
|
|
|
.replace(/\s{1,2}?{{FROM-FULL}}/g, '')
|
2021-02-02 19:23:32 +08:00
|
|
|
.replace(/{{DATE}}/g, new Date().format('LLLL'))
|
|
|
|
.replace(/{{TIME}}/g, new Date().format('LT'))
|
|
|
|
.replace(/{{MOMENT:[^}]+}}/g, '');
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2017-07-06 06:31:41 +08:00
|
|
|
setSignatureFromIdentity(identity) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity) {
|
2021-02-02 19:23:32 +08:00
|
|
|
this.editor(editor => {
|
|
|
|
let signature = identity.signature(),
|
|
|
|
isHtml = signature && ':HTML:' === signature.substr(0, 6);
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
editor.setSignature(
|
|
|
|
this.convertSignature(isHtml ? signature.substr(6) : signature),
|
|
|
|
isHtml, !!identity.signatureInsertBefore());
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {string=} type = ComposeType.Empty
|
|
|
|
* @param {?MessageModel|Array=} oMessageOrArray = null
|
|
|
|
* @param {Array=} aToEmails = null
|
|
|
|
* @param {Array=} aCcEmails = null
|
|
|
|
* @param {Array=} aBccEmails = null
|
|
|
|
* @param {string=} sCustomSubject = null
|
|
|
|
* @param {string=} sCustomPlainText = null
|
|
|
|
*/
|
|
|
|
onShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
|
2020-09-17 02:35:29 +08:00
|
|
|
rl.route.off();
|
2014-08-14 21:09:42 +08:00
|
|
|
|
2020-09-02 15:32:28 +08:00
|
|
|
const ro = this.resizeObserver;
|
|
|
|
ro.observe(ro.compose);
|
|
|
|
ro.observe(ro.header);
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.autosaveStart();
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2021-08-17 00:09:54 +08:00
|
|
|
this.viewModelDom.dataset.wysiwyg = SettingsUserStore.editorDefaultType();
|
|
|
|
|
2021-03-11 05:41:35 +08:00
|
|
|
if (AppUserStore.composeInEdit()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
type = type || ComposeType.Empty;
|
2019-07-05 03:19:24 +08:00
|
|
|
if (ComposeType.Empty !== type) {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(AskPopupView, [
|
2019-07-05 03:19:24 +08:00
|
|
|
i18n('COMPOSE/DISCARD_UNSAVED_DATA'),
|
|
|
|
() => {
|
|
|
|
this.initOnShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText);
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
false
|
|
|
|
]);
|
|
|
|
} else {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.addEmailsTo(this.to, aToEmails);
|
|
|
|
this.addEmailsTo(this.cc, aCcEmails);
|
|
|
|
this.addEmailsTo(this.bcc, aBccEmails);
|
|
|
|
|
2020-08-18 03:57:56 +08:00
|
|
|
if (sCustomSubject && !this.subject()) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.subject(sCustomSubject);
|
|
|
|
}
|
|
|
|
}
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.initOnShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText);
|
2014-12-28 03:48:55 +08:00
|
|
|
}
|
2021-07-16 03:01:41 +08:00
|
|
|
|
2021-07-16 22:24:07 +08:00
|
|
|
// (navigator.standalone || matchMedia('(display-mode: standalone)').matches || matchMedia('(display-mode: fullscreen)').matches) &&
|
2021-07-16 03:01:41 +08:00
|
|
|
ThemeStore.isMobile() && this.oContent.requestFullscreen && this.oContent.requestFullscreen();
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-12-31 20:21:43 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {Function} fKoValue
|
|
|
|
* @param {Array} emails
|
|
|
|
*/
|
|
|
|
addEmailsTo(fKoValue, emails) {
|
2021-07-22 03:34:17 +08:00
|
|
|
if (arrayLength(emails)) {
|
2020-08-07 00:24:46 +08:00
|
|
|
const value = fKoValue().trim(),
|
2020-07-23 22:06:16 +08:00
|
|
|
values = emails.map(item => item ? item.toLine(false) : null)
|
2020-10-03 05:54:15 +08:00
|
|
|
.validUnique();
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2020-08-07 00:24:46 +08:00
|
|
|
fKoValue(value + (value ? ', ' : '') + values.join(', ').trim());
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {Array} aList
|
|
|
|
* @param {boolean} bFriendly
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
emailArrayToStringLineHelper(aList, bFriendly) {
|
|
|
|
bFriendly = !!bFriendly;
|
2020-07-23 02:09:31 +08:00
|
|
|
return aList.map(item => item.toLine(bFriendly)).join(', ');
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-12-28 03:48:55 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
isPlainEditor() {
|
2021-08-17 00:09:54 +08:00
|
|
|
let type = SettingsUserStore.editorDefaultType();
|
2021-02-02 19:23:32 +08:00
|
|
|
return EditorDefaultType.Html !== type && EditorDefaultType.HtmlForced !== type;
|
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {string=} sType = ComposeType.Empty
|
|
|
|
* @param {?MessageModel|Array=} oMessageOrArray = null
|
|
|
|
* @param {Array=} aToEmails = null
|
|
|
|
* @param {Array=} aCcEmails = null
|
|
|
|
* @param {Array=} aBccEmails = null
|
|
|
|
* @param {string=} sCustomSubject = null
|
|
|
|
* @param {string=} sCustomPlainText = null
|
|
|
|
*/
|
2019-07-05 03:19:24 +08:00
|
|
|
initOnShow(sType, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
|
|
|
|
let sFrom = '',
|
2016-08-17 06:01:20 +08:00
|
|
|
sTo = '',
|
|
|
|
sCc = '',
|
|
|
|
sDate = '',
|
|
|
|
sSubject = '',
|
|
|
|
sText = '',
|
|
|
|
sReplyTitle = '',
|
|
|
|
identity = null,
|
|
|
|
aDraftInfo = null,
|
|
|
|
message = null;
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
const excludeEmail = {},
|
2021-03-11 05:41:35 +08:00
|
|
|
mEmail = AccountUserStore.email(),
|
2016-08-17 06:01:20 +08:00
|
|
|
lineComposeType = sType || ComposeType.Empty;
|
|
|
|
|
|
|
|
oMessageOrArray = oMessageOrArray || null;
|
2020-08-18 03:57:56 +08:00
|
|
|
if (oMessageOrArray) {
|
2019-07-05 03:19:24 +08:00
|
|
|
message =
|
2021-07-22 03:34:17 +08:00
|
|
|
1 === arrayLength(oMessageOrArray)
|
2019-07-05 03:19:24 +08:00
|
|
|
? oMessageOrArray[0]
|
2021-07-22 03:34:17 +08:00
|
|
|
: isArray(oMessageOrArray)
|
|
|
|
? null
|
|
|
|
: oMessageOrArray;
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.oLastMessage = message;
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (null !== mEmail) {
|
2016-08-17 06:01:20 +08:00
|
|
|
excludeEmail[mEmail] = true;
|
|
|
|
}
|
2014-05-24 06:37:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.reset();
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
identity = this.findIdentityByMessage(lineComposeType, message);
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity) {
|
2016-08-17 06:01:20 +08:00
|
|
|
excludeEmail[identity.email()] = true;
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
if (arrayLength(aToEmails)) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.to(this.emailArrayToStringLineHelper(aToEmails));
|
2015-02-01 03:00:10 +08:00
|
|
|
}
|
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
if (arrayLength(aCcEmails)) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.cc(this.emailArrayToStringLineHelper(aCcEmails));
|
2015-02-01 03:00:10 +08:00
|
|
|
}
|
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
if (arrayLength(aBccEmails)) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.bcc(this.emailArrayToStringLineHelper(aBccEmails));
|
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2020-07-28 23:20:14 +08:00
|
|
|
if (lineComposeType && message) {
|
2021-01-27 07:26:31 +08:00
|
|
|
sDate = timestampToString(message.dateTimeStampInUTC(), 'FULL');
|
2016-08-17 06:01:20 +08:00
|
|
|
sSubject = message.subject();
|
|
|
|
aDraftInfo = message.aDraftInfo;
|
2020-08-27 21:45:47 +08:00
|
|
|
sText = message.bodyAsHTML();
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
let resplyAllParts = null;
|
2019-07-05 03:19:24 +08:00
|
|
|
switch (lineComposeType) {
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Empty:
|
|
|
|
break;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Reply:
|
|
|
|
this.to(this.emailArrayToStringLineHelper(message.replyEmails(excludeEmail)));
|
|
|
|
this.subject(replySubjectAdd('Re', sSubject));
|
2020-09-23 17:20:18 +08:00
|
|
|
this.prepareMessageAttachments(message, lineComposeType);
|
2020-10-23 21:15:54 +08:00
|
|
|
this.aDraftInfo = ['reply', message.uid, message.folder];
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sInReplyTo = message.sMessageId;
|
2020-08-07 00:24:46 +08:00
|
|
|
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
|
2016-08-17 06:01:20 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ComposeType.ReplyAll:
|
|
|
|
resplyAllParts = message.replyAllEmails(excludeEmail);
|
|
|
|
this.to(this.emailArrayToStringLineHelper(resplyAllParts[0]));
|
|
|
|
this.cc(this.emailArrayToStringLineHelper(resplyAllParts[1]));
|
|
|
|
this.subject(replySubjectAdd('Re', sSubject));
|
2020-09-23 17:20:18 +08:00
|
|
|
this.prepareMessageAttachments(message, lineComposeType);
|
2020-10-23 21:15:54 +08:00
|
|
|
this.aDraftInfo = ['reply', message.uid, message.folder];
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sInReplyTo = message.sMessageId;
|
2020-10-23 21:15:54 +08:00
|
|
|
this.sReferences = (this.sInReplyTo + ' ' + message.references).trim();
|
2016-08-17 06:01:20 +08:00
|
|
|
break;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Forward:
|
|
|
|
this.subject(replySubjectAdd('Fwd', sSubject));
|
2020-09-23 17:20:18 +08:00
|
|
|
this.prepareMessageAttachments(message, lineComposeType);
|
2020-10-23 21:15:54 +08:00
|
|
|
this.aDraftInfo = ['forward', message.uid, message.folder];
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sInReplyTo = message.sMessageId;
|
2020-08-07 00:24:46 +08:00
|
|
|
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
|
2016-08-17 06:01:20 +08:00
|
|
|
break;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.ForwardAsAttachment:
|
|
|
|
this.subject(replySubjectAdd('Fwd', sSubject));
|
2020-09-23 17:20:18 +08:00
|
|
|
this.prepareMessageAttachments(message, lineComposeType);
|
2020-10-23 21:15:54 +08:00
|
|
|
this.aDraftInfo = ['forward', message.uid, message.folder];
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sInReplyTo = message.sMessageId;
|
2020-08-07 00:24:46 +08:00
|
|
|
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
|
2016-08-17 06:01:20 +08:00
|
|
|
break;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Draft:
|
|
|
|
this.to(this.emailArrayToStringLineHelper(message.to));
|
|
|
|
this.cc(this.emailArrayToStringLineHelper(message.cc));
|
|
|
|
this.bcc(this.emailArrayToStringLineHelper(message.bcc));
|
|
|
|
this.replyTo(this.emailArrayToStringLineHelper(message.replyTo));
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.bFromDraft = true;
|
2014-08-12 20:32:08 +08:00
|
|
|
|
2020-10-23 21:15:54 +08:00
|
|
|
this.draftFolder(message.folder);
|
2016-08-17 06:01:20 +08:00
|
|
|
this.draftUid(message.uid);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.subject(sSubject);
|
2020-09-23 17:20:18 +08:00
|
|
|
this.prepareMessageAttachments(message, lineComposeType);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
this.aDraftInfo = 3 === arrayLength(aDraftInfo) ? aDraftInfo : null;
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sInReplyTo = message.sInReplyTo;
|
|
|
|
this.sReferences = message.sReferences;
|
|
|
|
break;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.EditAsNew:
|
|
|
|
this.to(this.emailArrayToStringLineHelper(message.to));
|
|
|
|
this.cc(this.emailArrayToStringLineHelper(message.cc));
|
|
|
|
this.bcc(this.emailArrayToStringLineHelper(message.bcc));
|
|
|
|
this.replyTo(this.emailArrayToStringLineHelper(message.replyTo));
|
2014-02-07 07:22:39 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.subject(sSubject);
|
2020-09-23 17:20:18 +08:00
|
|
|
this.prepareMessageAttachments(message, lineComposeType);
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-07-22 03:34:17 +08:00
|
|
|
this.aDraftInfo = 3 === arrayLength(aDraftInfo) ? aDraftInfo : null;
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sInReplyTo = message.sInReplyTo;
|
|
|
|
this.sReferences = message.sReferences;
|
|
|
|
break;
|
|
|
|
// no default
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
switch (lineComposeType) {
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Reply:
|
|
|
|
case ComposeType.ReplyAll:
|
|
|
|
sFrom = message.fromToLine(false, true);
|
|
|
|
sReplyTitle = i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
|
2021-03-25 04:26:40 +08:00
|
|
|
DATETIME: sDate,
|
|
|
|
EMAIL: sFrom
|
2016-08-17 06:01:20 +08:00
|
|
|
});
|
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
sText = sText.replace(/<img[^>]+>/g, '').replace(/<a\s[^>]+><\/a>/g, '').trim();
|
|
|
|
sText = '<br/><br/>' + sReplyTitle + ':<br/><br/><blockquote>' + sText + '</blockquote>';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ComposeType.Forward:
|
|
|
|
sFrom = message.fromToLine(false, true);
|
|
|
|
sTo = message.toToLine(false, true);
|
|
|
|
sCc = message.ccToLine(false, true);
|
2019-07-05 03:19:24 +08:00
|
|
|
sText =
|
2021-02-02 19:23:32 +08:00
|
|
|
'<br/><br/>' +
|
2019-07-05 03:19:24 +08:00
|
|
|
i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
|
2021-02-02 19:23:32 +08:00
|
|
|
'<br/>' +
|
2021-01-22 00:21:19 +08:00
|
|
|
i18n('GLOBAL/FROM') +
|
2019-07-05 03:19:24 +08:00
|
|
|
': ' +
|
|
|
|
sFrom +
|
2021-02-02 19:23:32 +08:00
|
|
|
'<br/>' +
|
2021-01-22 00:21:19 +08:00
|
|
|
i18n('GLOBAL/TO') +
|
2019-07-05 03:19:24 +08:00
|
|
|
': ' +
|
|
|
|
sTo +
|
2021-02-02 19:23:32 +08:00
|
|
|
(sCc.length ? '<br/>' + i18n('GLOBAL/CC') + ': ' + sCc : '') +
|
|
|
|
'<br/>' +
|
2019-07-05 03:19:24 +08:00
|
|
|
i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') +
|
|
|
|
': ' +
|
|
|
|
encodeHtml(sDate) +
|
2021-02-02 19:23:32 +08:00
|
|
|
'<br/>' +
|
2021-01-22 00:21:19 +08:00
|
|
|
i18n('GLOBAL/SUBJECT') +
|
2019-07-05 03:19:24 +08:00
|
|
|
': ' +
|
|
|
|
encodeHtml(sSubject) +
|
2021-02-02 19:23:32 +08:00
|
|
|
'<br/><br/>' +
|
2020-08-07 00:24:46 +08:00
|
|
|
sText.trim() +
|
2021-02-02 19:23:32 +08:00
|
|
|
'<br/><br/>';
|
2016-08-17 06:01:20 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ComposeType.ForwardAsAttachment:
|
|
|
|
sText = '';
|
|
|
|
break;
|
|
|
|
// no default
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
this.editor(editor => {
|
|
|
|
editor.setHtml(sText);
|
2014-08-12 21:51:34 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (
|
2021-08-17 00:09:54 +08:00
|
|
|
EditorDefaultType.PlainForced === SettingsUserStore.editorDefaultType() ||
|
|
|
|
(!message.isHtml() && EditorDefaultType.HtmlForced !== SettingsUserStore.editorDefaultType())
|
2019-07-05 03:19:24 +08:00
|
|
|
) {
|
2021-02-02 19:23:32 +08:00
|
|
|
editor.modePlain();
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType) {
|
2017-07-06 06:31:41 +08:00
|
|
|
this.setSignatureFromIdentity(identity);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.setFocusInPopup();
|
|
|
|
});
|
2019-07-05 03:19:24 +08:00
|
|
|
} else if (ComposeType.Empty === lineComposeType) {
|
2020-08-18 03:57:56 +08:00
|
|
|
this.subject(null != sCustomSubject ? '' + sCustomSubject : '');
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-08-18 03:57:56 +08:00
|
|
|
sText = null != sCustomPlainText ? '' + sCustomPlainText : '';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
this.editor(editor => {
|
|
|
|
editor.setHtml(sText);
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
if (this.isPlainEditor()) {
|
|
|
|
editor.modePlain();
|
2015-02-08 09:11:13 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity) {
|
2017-07-06 06:31:41 +08:00
|
|
|
this.setSignatureFromIdentity(identity);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
this.setFocusInPopup();
|
2016-08-10 01:27:04 +08:00
|
|
|
});
|
2021-07-22 03:34:17 +08:00
|
|
|
} else if (arrayLength(oMessageOrArray)) {
|
2021-02-02 19:23:32 +08:00
|
|
|
oMessageOrArray.forEach(item => this.addMessageAsAttachment(item));
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2021-02-02 19:23:32 +08:00
|
|
|
this.editor(editor => {
|
|
|
|
if (this.isPlainEditor()) {
|
|
|
|
editor.setPlain('')
|
|
|
|
} else {
|
|
|
|
editor.setHtml('');
|
2015-02-08 09:11:13 +08:00
|
|
|
}
|
2015-02-26 22:47:37 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType) {
|
2017-07-06 06:31:41 +08:00
|
|
|
this.setSignatureFromIdentity(identity);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.setFocusInPopup();
|
|
|
|
});
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.setFocusInPopup();
|
|
|
|
}
|
2015-02-08 09:11:13 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
const downloads = this.getAttachmentsDownloadsForUpload();
|
2021-07-22 03:34:17 +08:00
|
|
|
if (arrayLength(downloads)) {
|
2021-03-16 16:46:23 +08:00
|
|
|
Remote.messageUploadAttachments((iError, oData) => {
|
2021-03-18 21:48:21 +08:00
|
|
|
if (!iError) {
|
2020-09-23 18:18:36 +08:00
|
|
|
Object.entries(oData.Result).forEach(([tempName, id]) => {
|
|
|
|
const attachment = this.getAttachmentById(id);
|
|
|
|
if (attachment) {
|
|
|
|
attachment.tempName(tempName);
|
|
|
|
attachment
|
|
|
|
.waiting(false)
|
|
|
|
.uploading(false)
|
|
|
|
.complete(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
2021-01-22 19:23:20 +08:00
|
|
|
this.attachments.forEach(attachment => {
|
2020-09-23 18:18:36 +08:00
|
|
|
if (attachment && attachment.fromMessage) {
|
|
|
|
attachment
|
|
|
|
.waiting(false)
|
|
|
|
.uploading(false)
|
|
|
|
.complete(true)
|
2021-01-04 19:08:41 +08:00
|
|
|
.error(getUploadErrorDescByCode(UploadErrorCode.NoFileUploaded));
|
2020-09-23 18:18:36 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, downloads);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2015-02-26 22:47:37 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (identity) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.currentIdentity(identity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setFocusInPopup() {
|
2020-09-30 18:31:34 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
if (!this.to()) {
|
2021-02-01 21:34:24 +08:00
|
|
|
this.to.focused(true);
|
2021-03-12 18:41:44 +08:00
|
|
|
} else if (!this.to.focused()) {
|
|
|
|
this.oEditor && this.oEditor.focus();
|
2020-09-30 18:31:34 +08:00
|
|
|
}
|
|
|
|
}, 100);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
tryToClosePopup() {
|
2021-01-26 05:00:13 +08:00
|
|
|
if (!isPopupVisible(AskPopupView) && this.modalVisibility()) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) {
|
2021-07-16 03:01:41 +08:00
|
|
|
this.closeCommand();
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(AskPopupView, [
|
2019-07-05 03:19:24 +08:00
|
|
|
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
|
|
|
() => {
|
2021-07-16 03:01:41 +08:00
|
|
|
this.modalVisibility() && this.closeCommand();
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2019-07-05 03:19:24 +08:00
|
|
|
]);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2015-03-14 07:10:00 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-07-01 06:50:11 +08:00
|
|
|
|
2020-10-09 21:00:26 +08:00
|
|
|
popupMenu(event) {
|
|
|
|
if (event.ctrlKey || event.metaKey || 'ContextMenu' == event.key
|
|
|
|
|| (this.oEditor && !this.oEditor.hasFocus() && !inFocus())) {
|
|
|
|
this.identitiesDropdownTrigger(true);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-02 15:32:28 +08:00
|
|
|
onBuild(dom) {
|
2021-08-13 02:17:37 +08:00
|
|
|
// 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);
|
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('q', 'meta', Scope.Compose, ()=>false);
|
|
|
|
shortcuts.add('w', 'meta', Scope.Compose, ()=>false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2021-08-13 16:03:13 +08:00
|
|
|
shortcuts.add('contextmenu', '', Scope.Compose, e => this.popupMenu(e));
|
|
|
|
shortcuts.add('m', 'meta', Scope.Compose, e => this.popupMenu(e));
|
2015-03-14 07:10:00 +08:00
|
|
|
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('escape,close', '', Scope.Compose, () => {
|
2020-09-26 06:02:29 +08:00
|
|
|
this.skipCommand();
|
|
|
|
return false;
|
|
|
|
});
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('arrowdown', 'meta', Scope.Compose, () => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.skipCommand();
|
2016-06-30 08:02:45 +08:00
|
|
|
return false;
|
|
|
|
});
|
2015-03-21 06:22:06 +08:00
|
|
|
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('s', 'meta', Scope.Compose, () => {
|
2021-03-06 17:07:54 +08:00
|
|
|
this.saveCommand();
|
|
|
|
return false;
|
|
|
|
});
|
2021-08-13 16:03:13 +08:00
|
|
|
shortcuts.add('save', '', Scope.Compose, () => {
|
2021-03-06 17:07:54 +08:00
|
|
|
this.saveCommand();
|
|
|
|
return false;
|
|
|
|
});
|
2014-02-12 08:08:31 +08:00
|
|
|
|
2020-09-04 18:05:17 +08:00
|
|
|
if (Settings.app('allowCtrlEnterOnCompose')) {
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('enter', 'meta', Scope.Compose, () => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sendCommand();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('mailsend', '', Scope.Compose, () => {
|
2020-10-09 16:31:44 +08:00
|
|
|
this.sendCommand();
|
|
|
|
return false;
|
|
|
|
});
|
2013-12-14 07:27:12 +08:00
|
|
|
|
2021-03-16 23:06:16 +08:00
|
|
|
shortcuts.add('escape,close', 'shift', Scope.Compose, () => {
|
2020-10-09 16:31:44 +08:00
|
|
|
this.modalVisibility() && this.tryToClosePopup();
|
2016-08-17 06:01:20 +08:00
|
|
|
return false;
|
2015-08-31 02:12:51 +08:00
|
|
|
});
|
2020-09-02 15:32:28 +08:00
|
|
|
|
|
|
|
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')];
|
2021-04-23 06:12:42 +08:00
|
|
|
|
2021-08-17 00:09:54 +08:00
|
|
|
this.editor(editor => editor[this.isPlainEditor()?'modePlain':'modeWysiwyg']());
|
2021-07-16 03:01:41 +08:00
|
|
|
|
|
|
|
// 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()
|
|
|
|
);
|
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} id
|
|
|
|
* @returns {?Object}
|
|
|
|
*/
|
|
|
|
getAttachmentById(id) {
|
2021-01-22 19:23:20 +08:00
|
|
|
return this.attachments.find(item => item && id === item.id);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-10-04 19:58:01 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
cancelAttachmentHelper(id, oJua) {
|
|
|
|
return () => {
|
2020-09-15 21:08:08 +08:00
|
|
|
const attachment = this.getAttachmentById(id);
|
2019-07-05 03:19:24 +08:00
|
|
|
if (attachment) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachments.remove(attachment);
|
|
|
|
delegateRunOnDestroy(attachment);
|
2020-10-26 19:54:03 +08:00
|
|
|
oJua && oJua.cancel(id);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2014-10-04 19:58:01 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
prepearAttachmentsForSendOrSave() {
|
|
|
|
const result = {};
|
2021-03-08 22:21:54 +08:00
|
|
|
this.attachments.forEach(item => {
|
|
|
|
if (item && item.complete() && item.tempName() && item.enabled()) {
|
2019-07-05 03:19:24 +08:00
|
|
|
result[item.tempName()] = [item.fileName(), item.isInline ? '1' : '0', item.CID, item.contentLocation];
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
});
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return result;
|
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {MessageModel} message
|
|
|
|
*/
|
|
|
|
addMessageAsAttachment(message) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (message) {
|
2016-08-17 06:01:20 +08:00
|
|
|
let temp = message.subject();
|
|
|
|
temp = '.eml' === temp.substr(-4).toLowerCase() ? temp : temp + '.eml';
|
2016-08-10 03:52:30 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
const attachment = new ComposeAttachmentModel(message.requestHash, temp, message.size());
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
attachment.fromMessage = true;
|
|
|
|
attachment.cancel = this.cancelAttachmentHelper(message.requestHash);
|
2019-07-05 03:19:24 +08:00
|
|
|
attachment
|
|
|
|
.waiting(false)
|
|
|
|
.uploading(true)
|
|
|
|
.complete(true);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachments.push(attachment);
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-01-05 03:30:07 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {string} url
|
|
|
|
* @param {string} name
|
|
|
|
* @param {number} size
|
|
|
|
* @returns {ComposeAttachmentModel}
|
|
|
|
*/
|
|
|
|
addAttachmentHelper(url, name, size) {
|
|
|
|
const attachment = new ComposeAttachmentModel(url, name, size);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
attachment.fromMessage = false;
|
|
|
|
attachment.cancel = this.cancelAttachmentHelper(url);
|
2019-07-05 03:19:24 +08:00
|
|
|
attachment
|
|
|
|
.waiting(false)
|
|
|
|
.uploading(true)
|
|
|
|
.complete(false);
|
2014-07-29 18:28:02 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachments.push(attachment);
|
2014-07-29 18:28:02 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachmentsPlace(true);
|
2016-08-10 02:58:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return attachment;
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {MessageModel} message
|
|
|
|
* @param {string} type
|
|
|
|
*/
|
2020-09-23 17:20:18 +08:00
|
|
|
prepareMessageAttachments(message, type) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (message) {
|
|
|
|
if (ComposeType.ForwardAsAttachment === type) {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.addMessageAsAttachment(message);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2021-01-22 19:23:20 +08:00
|
|
|
message.attachments.forEach(item => {
|
2016-08-17 06:01:20 +08:00
|
|
|
let add = false;
|
2019-07-05 03:19:24 +08:00
|
|
|
switch (type) {
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Reply:
|
|
|
|
case ComposeType.ReplyAll:
|
|
|
|
break;
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
case ComposeType.Forward:
|
|
|
|
case ComposeType.Draft:
|
|
|
|
case ComposeType.EditAsNew:
|
|
|
|
add = true;
|
|
|
|
break;
|
|
|
|
// no default
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
if (add) {
|
2020-09-19 19:53:14 +08:00
|
|
|
const attachment = ComposeAttachmentModel.fromAttachment(item);
|
2016-08-17 06:01:20 +08:00
|
|
|
attachment.cancel = this.cancelAttachmentHelper(item.download);
|
2019-07-05 03:19:24 +08:00
|
|
|
attachment
|
|
|
|
.waiting(false)
|
|
|
|
.uploading(true)
|
|
|
|
.complete(false);
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachments.push(attachment);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {boolean=} includeAttachmentInProgress = true
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isEmptyForm(includeAttachmentInProgress = true) {
|
2019-07-05 03:19:24 +08:00
|
|
|
const withoutAttachment = includeAttachmentInProgress
|
2021-01-22 19:23:20 +08:00
|
|
|
? !this.attachments.length
|
2021-03-08 22:21:54 +08:00
|
|
|
: !this.attachments.some(item => item && item.complete());
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
return (
|
2021-01-22 19:23:20 +08:00
|
|
|
!this.to.length &&
|
|
|
|
!this.cc.length &&
|
|
|
|
!this.bcc.length &&
|
|
|
|
!this.replyTo.length &&
|
|
|
|
!this.subject.length &&
|
2016-08-17 06:01:20 +08:00
|
|
|
withoutAttachment &&
|
2020-07-28 23:20:14 +08:00
|
|
|
(!this.oEditor || !this.oEditor.getData())
|
2019-07-05 03:19:24 +08:00
|
|
|
);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
reset() {
|
|
|
|
this.to('');
|
|
|
|
this.cc('');
|
|
|
|
this.bcc('');
|
|
|
|
this.replyTo('');
|
|
|
|
this.subject('');
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.requestDsn(false);
|
|
|
|
this.requestReadReceipt(false);
|
|
|
|
this.markAsImportant(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.attachmentsPlace(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.aDraftInfo = null;
|
|
|
|
this.sInReplyTo = '';
|
|
|
|
this.bFromDraft = false;
|
|
|
|
this.sReferences = '';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sendError(false);
|
|
|
|
this.sendSuccessButSaveError(false);
|
|
|
|
this.savedError(false);
|
|
|
|
this.savedTime(0);
|
|
|
|
this.emptyToError(false);
|
|
|
|
this.attachmentsInProcessError(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.showCc(false);
|
|
|
|
this.showBcc(false);
|
|
|
|
this.showReplyTo(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
delegateRunOnDestroy(this.attachments());
|
|
|
|
this.attachments([]);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.dragAndDropOver(false);
|
|
|
|
this.dragAndDropVisible(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.draftFolder('');
|
|
|
|
this.draftUid('');
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.sending(false);
|
|
|
|
this.saving(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2021-03-12 18:41:44 +08:00
|
|
|
this.oEditor && this.oEditor.clear();
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @returns {Array}
|
|
|
|
*/
|
|
|
|
getAttachmentsDownloadsForUpload() {
|
2021-01-22 19:23:20 +08:00
|
|
|
return this.attachments.filter(item => item && !item.tempName()).map(
|
2020-07-23 02:09:31 +08:00
|
|
|
item => item.id
|
2019-12-25 03:05:46 +08:00
|
|
|
);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
resizerTrigger() {
|
2020-09-02 15:32:28 +08:00
|
|
|
let ro = this.resizeObserver,
|
|
|
|
height = Math.max(200, ro.compose.clientHeight - ro.header.offsetHeight - ro.toolbar.offsetHeight) + 'px';
|
|
|
|
if (ro.height !== height) {
|
|
|
|
ro.height = height;
|
|
|
|
ro.els.forEach(element => element.style.height = height);
|
|
|
|
this.oEditor && this.oEditor.resize();
|
2020-08-19 17:30:31 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
export { ComposePopupView, ComposePopupView as default };
|