plugin architecture
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
import { Map } from 'immutable';
|
||||
import { SWITCH_VISUAL_MODE } from '../actions/editor';
|
||||
import { Map, List } from 'immutable';
|
||||
import { SWITCH_VISUAL_MODE, REGISTER_COMPONENT } from '../actions/editor';
|
||||
|
||||
const editor = (state = Map({ useVisualMode: true }), action) => {
|
||||
const editor = (state = Map({ useVisualMode: true, registeredComponents: List() }), action) => {
|
||||
switch (action.type) {
|
||||
case SWITCH_VISUAL_MODE:
|
||||
return Map({ useVisualMode: action.payload });
|
||||
|
||||
return state.setIn(['useVisualMode'], action.payload);
|
||||
case REGISTER_COMPONENT:
|
||||
return state.updateIn(['registeredComponents'], list => list.push(action.payload));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
Reference in New Issue
Block a user