diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-03-04 17:57:56 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-03-04 17:57:56 +0900 |
commit | 37410b874f89de4907ba038244318129835e8157 (patch) | |
tree | f9f3c8e0efc1fcd7117b2b681145464a3585781a /src | |
parent | 0211d7781fffdb0f4e9a5e523f0f6ea24c5c8db8 (diff) |
add hide action for console
Diffstat (limited to 'src')
-rw-r--r-- | src/console/actions/console.js | 8 | ||||
-rw-r--r-- | src/console/actions/index.js | 1 | ||||
-rw-r--r-- | src/console/index.js | 2 | ||||
-rw-r--r-- | src/console/reducers/index.js | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/src/console/actions/console.js b/src/console/actions/console.js index 2cf8e8d..f80045f 100644 --- a/src/console/actions/console.js +++ b/src/console/actions/console.js @@ -1,5 +1,11 @@ import actions from 'console/actions'; +const hide = () => { + return { + type: actions.CONSOLE_HIDE, + }; +}; + const showCommand = (text) => { return { type: actions.CONSOLE_SHOW_COMMAND, @@ -61,6 +67,6 @@ const completionPrev = () => { }; export { - showCommand, showFind, showError, showInfo, hideCommand, setConsoleText, + hide, showCommand, showFind, showError, showInfo, hideCommand, setConsoleText, setCompletions, completionNext, completionPrev }; diff --git a/src/console/actions/index.js b/src/console/actions/index.js index a85e329..b394179 100644 --- a/src/console/actions/index.js +++ b/src/console/actions/index.js @@ -1,5 +1,6 @@ export default { // console commands + CONSOLE_HIDE: 'console.hide', CONSOLE_SHOW_COMMAND: 'console.show.command', CONSOLE_SHOW_ERROR: 'console.show.error', CONSOLE_SHOW_INFO: 'console.show.info', diff --git a/src/console/index.js b/src/console/index.js index 86edd9a..156456c 100644 --- a/src/console/index.js +++ b/src/console/index.js @@ -24,6 +24,8 @@ const onMessage = (message) => { return store.dispatch(consoleActions.showError(message.text)); case messages.CONSOLE_SHOW_INFO: return store.dispatch(consoleActions.showInfo(message.text)); + case messages.CONSOLE_HIDE: + return store.dispatch(consoleActions.hide()); } }; diff --git a/src/console/reducers/index.js b/src/console/reducers/index.js index 60c0007..2aec55c 100644 --- a/src/console/reducers/index.js +++ b/src/console/reducers/index.js @@ -53,6 +53,10 @@ const nextConsoleText = (completions, group, item, defaults) => { export default function reducer(state = defaultState, action = {}) { switch (action.type) { + case actions.CONSOLE_HIDE: + return Object.assign({}, state, { + mode: '', + }); case actions.CONSOLE_SHOW_COMMAND: return Object.assign({}, state, { mode: 'command', |