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