command as action/reducer
This commit is contained in:
parent
14d13e2c3a
commit
bf890a6d9d
5 changed files with 71 additions and 50 deletions
|
@ -1,6 +1,7 @@
|
|||
import './console.scss';
|
||||
import * as backgroundActions from '../actions/background';
|
||||
import * as consoleActions from '../actions/console';
|
||||
import * as commandActions from '../actions/command';
|
||||
import Completion from './completion';
|
||||
import consoleReducer from '../reducers/console';
|
||||
|
||||
|
@ -10,13 +11,6 @@ var completion = null;
|
|||
var completionOrigin = "";
|
||||
let state = consoleReducer(undefined, {});
|
||||
|
||||
const keydownMessage = (input) => {
|
||||
return {
|
||||
type: 'vimvixen.command.enter',
|
||||
value: input.value
|
||||
};
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
return browser.runtime.sendMessage(consoleActions.hide());
|
||||
};
|
||||
|
@ -58,7 +52,7 @@ const handleKeydown = (e) => {
|
|||
case KeyboardEvent.DOM_VK_ESCAPE:
|
||||
return input.blur();
|
||||
case KeyboardEvent.DOM_VK_RETURN:
|
||||
return browser.runtime.sendMessage(keydownMessage(e.target));
|
||||
return browser.runtime.sendMessage(commandActions.exec(e.target.value));
|
||||
case KeyboardEvent.DOM_VK_TAB:
|
||||
if (e.shiftKey) {
|
||||
completePrev();
|
||||
|
|
Reference in a new issue