plugin architecture

This commit is contained in:
Cássio Zen
2016-08-17 09:52:17 -03:00
parent dea734ec21
commit a0a24ebf72
5 changed files with 59 additions and 7 deletions

View File

@ -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;
}