mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-28 18:41:34 +08:00
Resolve #348
This commit is contained in:
parent
7d845569d4
commit
671062af31
3 changed files with 11 additions and 19 deletions
|
@ -14,7 +14,7 @@ export class AttachmentModel extends AbstractModel {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.checked = ko.observable(false);
|
||||
this.checked = ko.observable(true);
|
||||
|
||||
this.mimeType = '';
|
||||
this.fileName = '';
|
||||
|
|
|
@ -93,7 +93,7 @@ export class MailMessageView extends AbstractViewRight {
|
|||
}, this.messageVisibility);
|
||||
|
||||
this.addObservables({
|
||||
showAttachmentControls: false,
|
||||
showAttachmentControls: !!Local.get(ClientSideKeyNameMessageAttachmentControls),
|
||||
downloadAsZipLoading: false,
|
||||
lastReplyAction_: '',
|
||||
showFullInfo: '1' === Local.get(ClientSideKeyNameMessageHeaderFullInfo),
|
||||
|
@ -124,8 +124,6 @@ export class MailMessageView extends AbstractViewRight {
|
|||
this.messageListOfThreadsLoading = ko.observable(false).extend({ rateLimit: 1 });
|
||||
this.highlightUnselectedAttachments = ko.observable(false).extend({ falseTimeout: 2000 });
|
||||
|
||||
this.showAttachmentControlsState = v => Local.set(ClientSideKeyNameMessageAttachmentControls, !!v);
|
||||
|
||||
this.downloadAsZipError = ko.observable(false).extend({ falseTimeout: 7000 });
|
||||
|
||||
this.messageDomFocused = ko.observable(false).extend({ rateLimit: 0 });
|
||||
|
@ -134,7 +132,7 @@ export class MailMessageView extends AbstractViewRight {
|
|||
this.viewHash = '';
|
||||
|
||||
this.addComputables({
|
||||
allowAttachmentControls: () => this.attachmentsActions.length && SettingsCapa('AttachmentsActions'),
|
||||
allowAttachmentControls: () => arrayLength(attachmentsActions) && SettingsCapa('AttachmentsActions'),
|
||||
|
||||
downloadAsZipAllowed: () => this.attachmentsActions.includes('zip') && this.allowAttachmentControls(),
|
||||
|
||||
|
@ -180,26 +178,15 @@ export class MailMessageView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
this.addSubscribables({
|
||||
showAttachmentControls: v => currentMessage()
|
||||
&& currentMessage().attachments.forEach(item => item && item.checked(!!v)),
|
||||
|
||||
lastReplyAction_: value => Local.set(ClientSideKeyNameLastReplyAction, value),
|
||||
|
||||
message: message => {
|
||||
MessageUserStore.activeDom(null);
|
||||
|
||||
if (message) {
|
||||
this.showAttachmentControls(false);
|
||||
if (Local.get(ClientSideKeyNameMessageAttachmentControls)) {
|
||||
setTimeout(() => {
|
||||
this.showAttachmentControls(true);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
if (this.viewHash !== message.hash) {
|
||||
this.scrollMessageToTop();
|
||||
}
|
||||
|
||||
this.viewHash = message.hash;
|
||||
this.viewFromShort(message.fromToLine(true, true));
|
||||
this.viewFromDkimData(message.fromDkimData());
|
||||
|
@ -509,6 +496,12 @@ export class MailMessageView extends AbstractViewRight {
|
|||
oMessageScrollerDom().scrollLeft = 0;
|
||||
}
|
||||
|
||||
toggleAttachmentControls() {
|
||||
const b = !this.showAttachmentControls();
|
||||
this.showAttachmentControls(b);
|
||||
Local.set(ClientSideKeyNameMessageAttachmentControls, b);
|
||||
}
|
||||
|
||||
downloadAsZip() {
|
||||
const hashes = (currentMessage() ? currentMessage().attachments : [])
|
||||
.map(item => (item && !item.isLinked() && item.checked() ? item.download : ''))
|
||||
|
|
|
@ -245,7 +245,7 @@
|
|||
click: function () { checked(!checked()); return false }"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<i class="fontastic controls-handle" data-bind="visible: allowAttachmentControls() && !showAttachmentControls(), click: function () { showAttachmentControls(true); showAttachmentControlsState(true); }">⚙</i>
|
||||
<i class="fontastic controls-handle" data-bind="visible: allowAttachmentControls() && !showAttachmentControls(), click: toggleAttachmentControls">⚙</i>
|
||||
</div>
|
||||
|
||||
<div class="attachmentsControls"
|
||||
|
@ -259,8 +259,7 @@
|
|||
data-i18n="MESSAGE/LINK_DOWNLOAD_AS_ZIP"></span>
|
||||
</span>
|
||||
|
||||
<a href="#" class="close" style="margin-right: 5px;"
|
||||
data-bind="click: function () { showAttachmentControls(false); showAttachmentControlsState(false); }">×</a>
|
||||
<a href="#" class="close" style="margin-right: 5px;" data-bind="click: toggleAttachmentControls">×</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue