aboutsummaryrefslogtreecommitdiff
path: root/src/content/components
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-02-26 12:46:07 +0000
committerGitHub <noreply@github.com>2018-02-26 12:46:07 +0000
commit0211d7781fffdb0f4e9a5e523f0f6ea24c5c8db8 (patch)
tree3be2c9e227a5e385f048f9a7b88530f5e47e82f6 /src/content/components
parent2fd6a3f90fe2c910aaa14556b0d55da4070aba85 (diff)
parent57dba2d841e088ee1a0921f36b30a081d02d041c (diff)
Merge pull request #351 from ueokande/cancel-by-ctrl-left-bracket
Cancel by ctrl left bracket
Diffstat (limited to 'src/content/components')
-rw-r--r--src/content/components/common/follow.js1
-rw-r--r--src/content/components/common/input.js6
-rw-r--r--src/content/components/top-content/follow-controller.js8
3 files changed, 12 insertions, 3 deletions
diff --git a/src/content/components/common/follow.js b/src/content/components/common/follow.js
index 42dd897..a8682c5 100644
--- a/src/content/components/common/follow.js
+++ b/src/content/components/common/follow.js
@@ -63,6 +63,7 @@ export default class Follow {
this.win.parent.postMessage(JSON.stringify({
type: messages.FOLLOW_KEY_PRESS,
key: key.key,
+ ctrlKey: key.ctrlKey,
}), '*');
return true;
}
diff --git a/src/content/components/common/input.js b/src/content/components/common/input.js
index 22b0a91..eefaf10 100644
--- a/src/content/components/common/input.js
+++ b/src/content/components/common/input.js
@@ -1,6 +1,10 @@
import * as dom from 'shared/utils/dom';
import * as keys from 'shared/utils/keys';
+const cancelKey = (e) => {
+ return e.key === 'Escape' || e.key === '[' && e.ctrlKey;
+};
+
export default class InputComponent {
constructor(target) {
this.pressed = {};
@@ -37,7 +41,7 @@ export default class InputComponent {
capture(e) {
if (this.fromInput(e)) {
- if (e.key === 'Escape' && e.target.blur) {
+ if (cancelKey(e) && e.target.blur) {
e.target.blur();
}
return;
diff --git a/src/content/components/top-content/follow-controller.js b/src/content/components/top-content/follow-controller.js
index 1e7f3cd..1b5586b 100644
--- a/src/content/components/top-content/follow-controller.js
+++ b/src/content/components/top-content/follow-controller.js
@@ -32,7 +32,7 @@ export default class FollowController {
case messages.FOLLOW_RESPONSE_COUNT_TARGETS:
return this.create(message.count, sender);
case messages.FOLLOW_KEY_PRESS:
- return this.keyPress(message.key);
+ return this.keyPress(message.key, message.ctrlKey);
}
}
@@ -69,7 +69,11 @@ export default class FollowController {
});
}
- keyPress(key) {
+ keyPress(key, ctrlKey) {
+ if (key === '[' && ctrlKey) {
+ this.store.dispatch(followControllerActions.disable());
+ return true;
+ }
switch (key) {
case 'Enter':
this.activate();