Merge pull request #126 from ueokande/69-fix-completion-navigate
fix completion navigate
This commit is contained in:
commit
e4ff3a78fb
1 changed files with 4 additions and 13 deletions
|
@ -4,7 +4,6 @@ import * as consoleActions from 'console/actions/console';
|
||||||
export default class ConsoleComponent {
|
export default class ConsoleComponent {
|
||||||
constructor(wrapper, store) {
|
constructor(wrapper, store) {
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
this.prevValue = '';
|
|
||||||
this.prevState = {};
|
this.prevState = {};
|
||||||
this.completionOrigin = '';
|
this.completionOrigin = '';
|
||||||
this.store = store;
|
this.store = store;
|
||||||
|
@ -13,7 +12,7 @@ export default class ConsoleComponent {
|
||||||
let input = doc.querySelector('#vimvixen-console-command-input');
|
let input = doc.querySelector('#vimvixen-console-command-input');
|
||||||
input.addEventListener('blur', this.onBlur.bind(this));
|
input.addEventListener('blur', this.onBlur.bind(this));
|
||||||
input.addEventListener('keydown', this.onKeyDown.bind(this));
|
input.addEventListener('keydown', this.onKeyDown.bind(this));
|
||||||
input.addEventListener('keyup', this.onKeyUp.bind(this));
|
input.addEventListener('input', this.onInput.bind(this));
|
||||||
|
|
||||||
this.hideCommand();
|
this.hideCommand();
|
||||||
this.hideMessage();
|
this.hideMessage();
|
||||||
|
@ -53,22 +52,14 @@ export default class ConsoleComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyUp(e) {
|
onInput(e) {
|
||||||
if (e.keyCode === KeyboardEvent.DOM_VK_TAB) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e.target.value === this.prevValue) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let doc = this.wrapper.ownerDocument;
|
let doc = this.wrapper.ownerDocument;
|
||||||
let input = doc.querySelector('#vimvixen-console-command-input');
|
let input = doc.querySelector('#vimvixen-console-command-input');
|
||||||
this.completionOrigin = input.value;
|
this.completionOrigin = input.value;
|
||||||
|
|
||||||
this.prevValue = e.target.value;
|
|
||||||
return browser.runtime.sendMessage({
|
return browser.runtime.sendMessage({
|
||||||
type: messages.CONSOLE_QUERY_COMPLETIONS,
|
type: messages.CONSOLE_QUERY_COMPLETIONS,
|
||||||
text: e.target.value
|
text: e.target.value,
|
||||||
}).then((completions) => {
|
}).then((completions) => {
|
||||||
this.store.dispatch(consoleActions.setCompletions(completions));
|
this.store.dispatch(consoleActions.setCompletions(completions));
|
||||||
});
|
});
|
||||||
|
@ -113,7 +104,7 @@ export default class ConsoleComponent {
|
||||||
input.focus();
|
input.focus();
|
||||||
|
|
||||||
window.focus();
|
window.focus();
|
||||||
this.prevValue = '';
|
this.onInput({ target: input });
|
||||||
}
|
}
|
||||||
|
|
||||||
hideCommand() {
|
hideCommand() {
|
||||||
|
|
Reference in a new issue