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 | |
parent | 003742ec51aa7aea9214442bc0b611e2eb5eaf6e (diff) |
Scroll on global mark and handle gone tab
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/components/common/mark.js | 8 | ||||
-rw-r--r-- | src/content/components/top-content/index.js | 3 |
2 files changed, 9 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); diff --git a/src/content/components/top-content/index.js b/src/content/components/top-content/index.js index e22e957..1aaef1b 100644 --- a/src/content/components/top-content/index.js +++ b/src/content/components/top-content/index.js @@ -3,6 +3,7 @@ import FollowController from './follow-controller'; import FindComponent from './find'; import * as consoleFrames from '../../console-frames'; import messages from 'shared/messages'; +import * as scrolls from 'content/scrolls'; export default class TopContent { @@ -33,6 +34,8 @@ export default class TopContent { type: messages.ADDON_ENABLED_RESPONSE, enabled: addonState.enabled, }); + case messages.TAB_SCROLL_TO: + return scrolls.scrollTo(message.x, message.y, false); } } } |