aboutsummaryrefslogtreecommitdiff
path: root/src/content/controllers/KeymapController.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/controllers/KeymapController.ts')
-rw-r--r--src/content/controllers/KeymapController.ts114
1 files changed, 56 insertions, 58 deletions
diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts
index 639b4a1..092e55c 100644
--- a/src/content/controllers/KeymapController.ts
+++ b/src/content/controllers/KeymapController.ts
@@ -1,15 +1,15 @@
-import { injectable, inject } from 'tsyringe';
-import * as operations from '../../shared/operations';
-import KeymapUseCase from '../usecases/KeymapUseCase';
-import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase';
-import FindSlaveUseCase from '../usecases/FindSlaveUseCase';
-import ScrollUseCase from '../usecases/ScrollUseCase';
-import FocusUseCase from '../usecases/FocusUseCase';
-import ClipboardUseCase from '../usecases/ClipboardUseCase';
-import OperationClient from '../client/OperationClient';
-import MarkKeyyUseCase from '../usecases/MarkKeyUseCase';
-import FollowMasterClient from '../client/FollowMasterClient';
-import Key from '../../shared/settings/Key';
+import { injectable, inject } from "tsyringe";
+import * as operations from "../../shared/operations";
+import KeymapUseCase from "../usecases/KeymapUseCase";
+import AddonEnabledUseCase from "../usecases/AddonEnabledUseCase";
+import FindSlaveUseCase from "../usecases/FindSlaveUseCase";
+import ScrollUseCase from "../usecases/ScrollUseCase";
+import FocusUseCase from "../usecases/FocusUseCase";
+import ClipboardUseCase from "../usecases/ClipboardUseCase";
+import OperationClient from "../client/OperationClient";
+import MarkKeyyUseCase from "../usecases/MarkKeyUseCase";
+import FollowMasterClient from "../client/FollowMasterClient";
+import Key from "../../shared/settings/Key";
@injectable()
export default class KeymapController {
@@ -22,13 +22,12 @@ export default class KeymapController {
private clipbaordUseCase: ClipboardUseCase,
private markKeyUseCase: MarkKeyyUseCase,
- @inject('OperationClient')
+ @inject("OperationClient")
private operationClient: OperationClient,
- @inject('FollowMasterClient')
- private followMasterClient: FollowMasterClient,
- ) {
- }
+ @inject("FollowMasterClient")
+ private followMasterClient: FollowMasterClient
+ ) {}
// eslint-disable-next-line complexity, max-lines-per-function
press(key: Key): boolean {
@@ -43,47 +42,46 @@ export default class KeymapController {
const doFunc = ((op: operations.Operation) => {
switch (op.type) {
- case operations.ADDON_ENABLE:
- return () => this.addonEnabledUseCase.enable();
- case operations.ADDON_DISABLE:
- return () => this.addonEnabledUseCase.disable();
- case operations.ADDON_TOGGLE_ENABLED:
- return () => this.addonEnabledUseCase.toggle();
- case operations.FIND_NEXT:
- return () => this.findSlaveUseCase.findNext();
- case operations.FIND_PREV:
- return () => this.findSlaveUseCase.findPrev();
- case operations.SCROLL_VERTICALLY:
- return () => this.scrollUseCase.scrollVertically(op.count);
- case operations.SCROLL_HORIZONALLY:
- return () => this.scrollUseCase.scrollHorizonally(op.count);
- case operations.SCROLL_PAGES:
- return () => this.scrollUseCase.scrollPages(op.count);
- case operations.SCROLL_TOP:
- return () => this.scrollUseCase.scrollToTop();
- case operations.SCROLL_BOTTOM:
- return () => this.scrollUseCase.scrollToBottom();
- case operations.SCROLL_HOME:
- return () => this.scrollUseCase.scrollToHome();
- case operations.SCROLL_END:
- return () => this.scrollUseCase.scrollToEnd();
- case operations.FOLLOW_START:
- return () => this.followMasterClient.startFollow(
- op.newTab, op.background);
- case operations.MARK_SET_PREFIX:
- return () => this.markKeyUseCase.enableSetMode();
- case operations.MARK_JUMP_PREFIX:
- return () => this.markKeyUseCase.enableJumpMode();
- case operations.FOCUS_INPUT:
- return () => this.focusUseCase.focusFirstInput();
- case operations.URLS_YANK:
- return () => this.clipbaordUseCase.yankCurrentURL();
- case operations.URLS_PASTE:
- return () => this.clipbaordUseCase.openOrSearch(
- op.newTab ? op.newTab : false,
- );
- default:
- return null;
+ case operations.ADDON_ENABLE:
+ return () => this.addonEnabledUseCase.enable();
+ case operations.ADDON_DISABLE:
+ return () => this.addonEnabledUseCase.disable();
+ case operations.ADDON_TOGGLE_ENABLED:
+ return () => this.addonEnabledUseCase.toggle();
+ case operations.FIND_NEXT:
+ return () => this.findSlaveUseCase.findNext();
+ case operations.FIND_PREV:
+ return () => this.findSlaveUseCase.findPrev();
+ case operations.SCROLL_VERTICALLY:
+ return () => this.scrollUseCase.scrollVertically(op.count);
+ case operations.SCROLL_HORIZONALLY:
+ return () => this.scrollUseCase.scrollHorizonally(op.count);
+ case operations.SCROLL_PAGES:
+ return () => this.scrollUseCase.scrollPages(op.count);
+ case operations.SCROLL_TOP:
+ return () => this.scrollUseCase.scrollToTop();
+ case operations.SCROLL_BOTTOM:
+ return () => this.scrollUseCase.scrollToBottom();
+ case operations.SCROLL_HOME:
+ return () => this.scrollUseCase.scrollToHome();
+ case operations.SCROLL_END:
+ return () => this.scrollUseCase.scrollToEnd();
+ case operations.FOLLOW_START:
+ return () =>
+ this.followMasterClient.startFollow(op.newTab, op.background);
+ case operations.MARK_SET_PREFIX:
+ return () => this.markKeyUseCase.enableSetMode();
+ case operations.MARK_JUMP_PREFIX:
+ return () => this.markKeyUseCase.enableJumpMode();
+ case operations.FOCUS_INPUT:
+ return () => this.focusUseCase.focusFirstInput();
+ case operations.URLS_YANK:
+ return () => this.clipbaordUseCase.yankCurrentURL();
+ case operations.URLS_PASTE:
+ return () =>
+ this.clipbaordUseCase.openOrSearch(op.newTab ? op.newTab : false);
+ default:
+ return null;
}
})(nextOp.op);