show find in console
This commit is contained in:
parent
cb4b26e03f
commit
be37c42d28
11 changed files with 45 additions and 9 deletions
|
@ -7,6 +7,12 @@ const showCommand = (text) => {
|
|||
};
|
||||
};
|
||||
|
||||
const showFind = () => {
|
||||
return {
|
||||
type: actions.CONSOLE_SHOW_FIND,
|
||||
};
|
||||
};
|
||||
|
||||
const showError = (text) => {
|
||||
return {
|
||||
type: actions.CONSOLE_SHOW_ERROR,
|
||||
|
@ -47,6 +53,6 @@ const completionPrev = () => {
|
|||
};
|
||||
|
||||
export {
|
||||
showCommand, showError, showInfo, hideCommand,
|
||||
showCommand, showFind, showError, showInfo, hideCommand,
|
||||
setCompletions, completionNext, completionPrev
|
||||
};
|
||||
|
|
|
@ -7,4 +7,5 @@ export default {
|
|||
CONSOLE_SET_COMPLETIONS: 'console.set.completions',
|
||||
CONSOLE_COMPLETION_NEXT: 'console.completion.next',
|
||||
CONSOLE_COMPLETION_PREV: 'console.completion.prev',
|
||||
CONSOLE_SHOW_FIND: 'console.show.find',
|
||||
};
|
||||
|
|
|
@ -68,8 +68,10 @@ export default class ConsoleComponent {
|
|||
update() {
|
||||
let state = this.store.getState();
|
||||
if (this.prevState.mode !== 'command' && state.mode === 'command') {
|
||||
this.showCommand(state.commandText);
|
||||
} else if (state.mode !== 'command') {
|
||||
this.showCommand(state.consoleText);
|
||||
} else if (this.prevState.mode !== 'find' && state.mode === 'find') {
|
||||
this.showFind();
|
||||
} else if (state.mode !== 'command' && state.mode !== 'find') {
|
||||
this.hideCommand();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ const onMessage = (message) => {
|
|||
switch (message.type) {
|
||||
case messages.CONSOLE_SHOW_COMMAND:
|
||||
return store.dispatch(consoleActions.showCommand(message.command));
|
||||
case messages.CONSOLE_SHOW_FIND:
|
||||
return store.dispatch(consoleActions.showFind());
|
||||
case messages.CONSOLE_SHOW_ERROR:
|
||||
return store.dispatch(consoleActions.showError(message.text));
|
||||
case messages.CONSOLE_SHOW_INFO:
|
||||
|
|
|
@ -3,7 +3,7 @@ import actions from 'console/actions';
|
|||
const defaultState = {
|
||||
mode: '',
|
||||
messageText: '',
|
||||
commandText: '',
|
||||
consoleText: '',
|
||||
completions: [],
|
||||
groupSelection: -1,
|
||||
itemSelection: -1,
|
||||
|
@ -48,8 +48,13 @@ export default function reducer(state = defaultState, action = {}) {
|
|||
case actions.CONSOLE_SHOW_COMMAND:
|
||||
return Object.assign({}, state, {
|
||||
mode: 'command',
|
||||
commandText: action.text,
|
||||
errorShown: false,
|
||||
consoleText: action.text,
|
||||
completions: []
|
||||
});
|
||||
case actions.CONSOLE_SHOW_FIND:
|
||||
return Object.assign({}, state, {
|
||||
mode: 'find',
|
||||
consoleText: '',
|
||||
completions: []
|
||||
});
|
||||
case actions.CONSOLE_SHOW_ERROR:
|
||||
|
@ -64,7 +69,7 @@ export default function reducer(state = defaultState, action = {}) {
|
|||
});
|
||||
case actions.CONSOLE_HIDE_COMMAND:
|
||||
return Object.assign({}, state, {
|
||||
mode: state.mode === 'command' ? '' : state.mode,
|
||||
mode: state.mode === 'command' || state.mode === 'find' ? '' : state.mode,
|
||||
});
|
||||
case actions.CONSOLE_SET_COMPLETIONS:
|
||||
return Object.assign({}, state, {
|
||||
|
|
Reference in a new issue