2016-08-17 09:52:17 -03:00
|
|
|
import { Map, List } from 'immutable';
|
|
|
|
import { SWITCH_VISUAL_MODE, REGISTER_COMPONENT } from '../actions/editor';
|
2016-08-11 18:21:32 -03:00
|
|
|
|
2016-08-17 09:52:17 -03:00
|
|
|
const editor = (state = Map({ useVisualMode: true, registeredComponents: List() }), action) => {
|
2016-08-11 18:21:32 -03:00
|
|
|
switch (action.type) {
|
|
|
|
case SWITCH_VISUAL_MODE:
|
2016-08-17 09:52:17 -03:00
|
|
|
return state.setIn(['useVisualMode'], action.payload);
|
|
|
|
case REGISTER_COMPONENT:
|
|
|
|
return state.updateIn(['registeredComponents'], list => list.push(action.payload));
|
2016-08-11 18:21:32 -03:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default editor;
|