diff options
| author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-02 23:07:06 +0000 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-02 23:07:06 +0000 | 
| commit | e4ff3a78fbb8aed79292b20e89ca0f5e75a4a0bf (patch) | |
| tree | 362fdcc34ccc078789e9714d2517aec45bb812d9 | |
| parent | 9f1a18352fcac690ea714e84f6b1f6d6201ffd67 (diff) | |
| parent | 774a960a835b3f37b36ff69e1b9fcc8975f7c2f0 (diff) | |
Merge pull request #126 from ueokande/69-fix-completion-navigate
fix completion navigate
| -rw-r--r-- | src/console/components/console.js | 17 | 
1 files changed, 4 insertions, 13 deletions
diff --git a/src/console/components/console.js b/src/console/components/console.js index 49bda0e..5028e2a 100644 --- a/src/console/components/console.js +++ b/src/console/components/console.js @@ -4,7 +4,6 @@ import * as consoleActions from 'console/actions/console';  export default class ConsoleComponent {    constructor(wrapper, store) {      this.wrapper = wrapper; -    this.prevValue = '';      this.prevState = {};      this.completionOrigin = '';      this.store = store; @@ -13,7 +12,7 @@ export default class ConsoleComponent {      let input = doc.querySelector('#vimvixen-console-command-input');      input.addEventListener('blur', this.onBlur.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.hideMessage(); @@ -53,22 +52,14 @@ export default class ConsoleComponent {      }    } -  onKeyUp(e) { -    if (e.keyCode === KeyboardEvent.DOM_VK_TAB) { -      return; -    } -    if (e.target.value === this.prevValue) { -      return; -    } - +  onInput(e) {      let doc = this.wrapper.ownerDocument;      let input = doc.querySelector('#vimvixen-console-command-input');      this.completionOrigin = input.value; -    this.prevValue = e.target.value;      return browser.runtime.sendMessage({        type: messages.CONSOLE_QUERY_COMPLETIONS, -      text: e.target.value +      text: e.target.value,      }).then((completions) => {        this.store.dispatch(consoleActions.setCompletions(completions));      }); @@ -113,7 +104,7 @@ export default class ConsoleComponent {      input.focus();      window.focus(); -    this.prevValue = ''; +    this.onInput({ target: input });    }    hideCommand() {  | 
