diff options
Diffstat (limited to 'src/content/components/common/mark.ts')
-rw-r--r-- | src/content/components/common/mark.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/content/components/common/mark.ts b/src/content/components/common/mark.ts deleted file mode 100644 index 058b873..0000000 --- a/src/content/components/common/mark.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as markActions from '../../actions/mark'; -import * as consoleFrames from '../..//console-frames'; -import Key from '../../domains/Key'; - -import MarkUseCase from '../../usecases/MarkUseCase'; - -let markUseCase = new MarkUseCase(); - -const cancelKey = (key: Key): boolean => { - return key.key === 'Esc' || key.key === '[' && Boolean(key.ctrlKey); -}; - -export default class MarkComponent { - private store: any; - - constructor(store: any) { - this.store = store; - } - - // eslint-disable-next-line max-statements - key(key: Key) { - let { mark: markState } = this.store.getState(); - - if (!markState.setMode && !markState.jumpMode) { - return false; - } - - if (cancelKey(key)) { - this.store.dispatch(markActions.cancel()); - return true; - } - - if (key.ctrlKey || key.metaKey || key.altKey) { - consoleFrames.postError('Unknown mark'); - } else if (markState.setMode) { - markUseCase.set(key.key); - } else if (markState.jumpMode) { - markUseCase.jump(key.key); - } - - this.store.dispatch(markActions.cancel()); - return true; - } -} |