Merge pull request #351 from ueokande/cancel-by-ctrl-left-bracket
Cancel by ctrl left bracket
This commit is contained in:
commit
0211d7781f
4 changed files with 15 additions and 3 deletions
|
@ -50,6 +50,9 @@ export default class ConsoleComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyDown(e) {
|
onKeyDown(e) {
|
||||||
|
if (e.keyCode === KeyboardEvent.DOM_VK_ESCAPE && e.ctrlKey) {
|
||||||
|
return this.hideCommand();
|
||||||
|
}
|
||||||
switch (e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case KeyboardEvent.DOM_VK_ESCAPE:
|
case KeyboardEvent.DOM_VK_ESCAPE:
|
||||||
return this.hideCommand();
|
return this.hideCommand();
|
||||||
|
|
|
@ -63,6 +63,7 @@ export default class Follow {
|
||||||
this.win.parent.postMessage(JSON.stringify({
|
this.win.parent.postMessage(JSON.stringify({
|
||||||
type: messages.FOLLOW_KEY_PRESS,
|
type: messages.FOLLOW_KEY_PRESS,
|
||||||
key: key.key,
|
key: key.key,
|
||||||
|
ctrlKey: key.ctrlKey,
|
||||||
}), '*');
|
}), '*');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import * as dom from 'shared/utils/dom';
|
import * as dom from 'shared/utils/dom';
|
||||||
import * as keys from 'shared/utils/keys';
|
import * as keys from 'shared/utils/keys';
|
||||||
|
|
||||||
|
const cancelKey = (e) => {
|
||||||
|
return e.key === 'Escape' || e.key === '[' && e.ctrlKey;
|
||||||
|
};
|
||||||
|
|
||||||
export default class InputComponent {
|
export default class InputComponent {
|
||||||
constructor(target) {
|
constructor(target) {
|
||||||
this.pressed = {};
|
this.pressed = {};
|
||||||
|
@ -37,7 +41,7 @@ export default class InputComponent {
|
||||||
|
|
||||||
capture(e) {
|
capture(e) {
|
||||||
if (this.fromInput(e)) {
|
if (this.fromInput(e)) {
|
||||||
if (e.key === 'Escape' && e.target.blur) {
|
if (cancelKey(e) && e.target.blur) {
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default class FollowController {
|
||||||
case messages.FOLLOW_RESPONSE_COUNT_TARGETS:
|
case messages.FOLLOW_RESPONSE_COUNT_TARGETS:
|
||||||
return this.create(message.count, sender);
|
return this.create(message.count, sender);
|
||||||
case messages.FOLLOW_KEY_PRESS:
|
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) {
|
switch (key) {
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
this.activate();
|
this.activate();
|
||||||
|
|
Reference in a new issue