diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-10-12 14:59:45 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-10-12 14:59:45 +0900 |
commit | e248477ecb46596af734589615118ba573971dc0 (patch) | |
tree | 8167efec0a4f539d4aecea4a0555c38f6a0934a3 /src/content/components/common/mark.js | |
parent | 003742ec51aa7aea9214442bc0b611e2eb5eaf6e (diff) |
Scroll on global mark and handle gone tab
Diffstat (limited to 'src/content/components/common/mark.js')
-rw-r--r-- | src/content/components/common/mark.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/content/components/common/mark.js b/src/content/components/common/mark.js index ce35afa..1ed636b 100644 --- a/src/content/components/common/mark.js +++ b/src/content/components/common/mark.js @@ -7,6 +7,10 @@ const cancelKey = (key) => { return key.key === 'Esc' || key.key === '[' && key.ctrlKey; }; +const globalKey = (key) => { + return (/^[A-Z0-9]$/).test(key); +}; + export default class MarkComponent { constructor(body, store) { this.body = body; @@ -30,9 +34,9 @@ export default class MarkComponent { if (key.ctrlKey || key.metaKey || key.altKey) { consoleFrames.postError(window.document, 'Unknown mark'); - } else if (key.shiftKey && markStage.setMode) { + } else if (globalKey(key.key) && markStage.setMode) { this.doSetGlobal(key); - } else if (key.shiftKey && markStage.jumpMode) { + } else if (globalKey(key.key) && markStage.jumpMode) { this.doJumpGlobal(key); } else if (markStage.setMode) { this.doSet(key); |