mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Replace babel command decorators with proper knockout command decorators
This commit is contained in:
parent
b6d8fa5b3f
commit
540b12ed26
27 changed files with 181 additions and 132 deletions
|
|
@ -16,7 +16,7 @@ import * as Local from 'Storage/Client';
|
|||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
import { command, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewCenter } from 'Knoin/AbstractViews';
|
||||
|
||||
import { Settings } from 'Common/Globals';
|
||||
|
|
@ -113,13 +113,16 @@ class LoginUserView extends AbstractViewCenter {
|
|||
if (Settings.get('AdditionalLoginError') && !this.submitError()) {
|
||||
this.submitError(Settings.get('AdditionalLoginError'));
|
||||
}
|
||||
|
||||
decorateKoCommands(this, {
|
||||
submitCommand: self => !self.submitRequest()
|
||||
});
|
||||
}
|
||||
|
||||
windowOpenFeatures(wh) {
|
||||
return `left=200,top=100,width=${wh},height=${wh},menubar=no,status=no,resizable=yes,scrollbars=yes`;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest())
|
||||
submitCommand() {
|
||||
this.emailError(false);
|
||||
this.passwordError(false);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import { ThemeStore } from 'Stores/Theme';
|
|||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
import { command, showScreenPopup, popupVisibility } from 'Knoin/Knoin';
|
||||
import { decorateKoCommands, showScreenPopup, popupVisibility } from 'Knoin/Knoin';
|
||||
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
||||
|
||||
import { FolderClearPopupView } from 'View/Popup/FolderClear';
|
||||
|
|
@ -237,23 +237,33 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
MessageStore.messageListEndHash.subscribe((() =>
|
||||
this.selector.scrollToFocused()
|
||||
).throttle(50));
|
||||
|
||||
decorateKoCommands(this, {
|
||||
clearCommand: 1,
|
||||
reloadCommand: 1,
|
||||
multyForwardCommand: canBeMovedHelper,
|
||||
deleteWithoutMoveCommand: canBeMovedHelper,
|
||||
deleteCommand: canBeMovedHelper,
|
||||
archiveCommand: canBeMovedHelper,
|
||||
spamCommand: canBeMovedHelper,
|
||||
notSpamCommand: canBeMovedHelper,
|
||||
moveCommand: canBeMovedHelper,
|
||||
moveNewCommand: canBeMovedHelper,
|
||||
});
|
||||
}
|
||||
|
||||
@command()
|
||||
clearCommand() {
|
||||
if (Settings.capa(Capa.DangerousActions)) {
|
||||
showScreenPopup(FolderClearPopupView, [FolderStore.currentFolder()]);
|
||||
}
|
||||
}
|
||||
|
||||
@command()
|
||||
reloadCommand() {
|
||||
if (!MessageStore.messageListCompleteLoadingThrottleForAnimation() && this.allowReload) {
|
||||
rl.app.reloadMessageList(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
multyForwardCommand() {
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(ComposePopupView, [
|
||||
|
|
@ -263,7 +273,6 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
deleteWithoutMoveCommand() {
|
||||
if (Settings.capa(Capa.DangerousActions)) {
|
||||
rl.app.deleteMessagesFromFolder(
|
||||
|
|
@ -275,7 +284,6 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
deleteCommand() {
|
||||
rl.app.deleteMessagesFromFolder(
|
||||
FolderType.Trash,
|
||||
|
|
@ -285,7 +293,6 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
);
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
archiveCommand() {
|
||||
rl.app.deleteMessagesFromFolder(
|
||||
FolderType.Archive,
|
||||
|
|
@ -295,7 +302,6 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
);
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
spamCommand() {
|
||||
rl.app.deleteMessagesFromFolder(
|
||||
FolderType.Spam,
|
||||
|
|
@ -305,7 +311,6 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
);
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
notSpamCommand() {
|
||||
rl.app.deleteMessagesFromFolder(
|
||||
FolderType.NotSpam,
|
||||
|
|
@ -315,10 +320,8 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
);
|
||||
}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
moveCommand() {} // eslint-disable-line no-empty-function
|
||||
moveCommand() {}
|
||||
|
||||
@command(canBeMovedHelper)
|
||||
moveNewCommand(vm, event) {
|
||||
if (this.newMoveToFolder && this.mobileCheckedStateShow()) {
|
||||
if (vm && event && event.preventDefault) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import * as Local from 'Storage/Client';
|
|||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
import { command, showScreenPopup, createCommand } from 'Knoin/Knoin';
|
||||
import { decorateKoCommands, showScreenPopup, createCommand } from 'Knoin/Knoin';
|
||||
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
||||
|
||||
import { ComposePopupView } from 'View/Popup/Compose';
|
||||
|
|
@ -266,29 +266,32 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
addEventListener('mailbox.message-view.toggle-full-screen', () => this.toggleFullScreen());
|
||||
|
||||
this.attachmentPreview = this.attachmentPreview.bind(this);
|
||||
|
||||
decorateKoCommands(this, {
|
||||
closeMessageCommand: 1,
|
||||
messageVisibilityCommand: self => self.messageVisibility(),
|
||||
messageEditCommand: self => self.messageVisibility(),
|
||||
goUpCommand: self => !self.messageListAndMessageViewLoading(),
|
||||
goDownCommand: self => !self.messageListAndMessageViewLoading()
|
||||
});
|
||||
}
|
||||
|
||||
@command()
|
||||
closeMessageCommand() {
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
@command((self) => self.messageVisibility())
|
||||
messageVisibilityCommand() {} // eslint-disable-line no-empty-function
|
||||
messageVisibilityCommand() {}
|
||||
|
||||
@command((self) => self.messageVisibility())
|
||||
messageEditCommand() {
|
||||
this.editMessage();
|
||||
}
|
||||
|
||||
@command((self) => !self.messageListAndMessageViewLoading())
|
||||
goUpCommand() {
|
||||
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-up',
|
||||
{detail:SettingsStore.usePreviewPane() || !!this.message()} // bForceSelect
|
||||
));
|
||||
}
|
||||
|
||||
@command((self) => !self.messageListAndMessageViewLoading())
|
||||
goDownCommand() {
|
||||
dispatchEvent(new CustomEvent('mailbox.message-list.selector.go-down',
|
||||
{detail:SettingsStore.usePreviewPane() || !!this.message()} // bForceSelect
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue