|
|
@ -31,14 +31,30 @@ export default class ConsoleComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doEnter(e) { |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
return this.onEntered(e.target.value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectNext(e) { |
|
|
|
|
|
|
|
this.store.dispatch(consoleActions.completionNext()); |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectPrev(e) { |
|
|
|
|
|
|
|
this.store.dispatch(consoleActions.completionPrev()); |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onKeyDown(e) { |
|
|
|
onKeyDown(e) { |
|
|
|
switch (e.keyCode) { |
|
|
|
switch (e.keyCode) { |
|
|
|
case KeyboardEvent.DOM_VK_ESCAPE: |
|
|
|
case KeyboardEvent.DOM_VK_ESCAPE: |
|
|
|
return this.hideCommand(); |
|
|
|
return this.hideCommand(); |
|
|
|
case KeyboardEvent.DOM_VK_RETURN: |
|
|
|
case KeyboardEvent.DOM_VK_RETURN: |
|
|
|
e.stopPropagation(); |
|
|
|
return this.doEnter(e); |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
return this.onEntered(e.target.value); |
|
|
|
|
|
|
|
case KeyboardEvent.DOM_VK_TAB: |
|
|
|
case KeyboardEvent.DOM_VK_TAB: |
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
|
this.store.dispatch(consoleActions.completionPrev()); |
|
|
|
this.store.dispatch(consoleActions.completionPrev()); |
|
|
@ -55,25 +71,25 @@ export default class ConsoleComponent { |
|
|
|
break; |
|
|
|
break; |
|
|
|
case KeyboardEvent.DOM_VK_M: |
|
|
|
case KeyboardEvent.DOM_VK_M: |
|
|
|
if (e.ctrlKey) { |
|
|
|
if (e.ctrlKey) { |
|
|
|
e.stopPropagation(); |
|
|
|
this.doEnter(e); |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
return this.onEntered(e.target.value); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case KeyboardEvent.DOM_VK_DOWN: |
|
|
|
|
|
|
|
this.selectNext(e); |
|
|
|
|
|
|
|
break; |
|
|
|
case KeyboardEvent.DOM_VK_N: |
|
|
|
case KeyboardEvent.DOM_VK_N: |
|
|
|
case KeyboardEvent.DOM_VK_J: |
|
|
|
case KeyboardEvent.DOM_VK_J: |
|
|
|
if (e.ctrlKey) { |
|
|
|
if (e.ctrlKey) { |
|
|
|
this.store.dispatch(consoleActions.completionNext()); |
|
|
|
this.selectNext(e); |
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case KeyboardEvent.DOM_VK_UP: |
|
|
|
|
|
|
|
this.selectPrev(e); |
|
|
|
|
|
|
|
break; |
|
|
|
case KeyboardEvent.DOM_VK_P: |
|
|
|
case KeyboardEvent.DOM_VK_P: |
|
|
|
case KeyboardEvent.DOM_VK_K: |
|
|
|
case KeyboardEvent.DOM_VK_K: |
|
|
|
if (e.ctrlKey) { |
|
|
|
if (e.ctrlKey) { |
|
|
|
this.store.dispatch(consoleActions.completionPrev()); |
|
|
|
this.selectPrev(e); |
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|