Pass plugins via context instead of using Redux store

This commit is contained in:
Cássio Zen
2016-08-18 09:09:54 -03:00
parent d22a4da057
commit 986e36c137
4 changed files with 58 additions and 48 deletions

View File

@ -1,12 +1,10 @@
import { Map, List } from 'immutable';
import { SWITCH_VISUAL_MODE, REGISTER_COMPONENT } from '../actions/editor';
import { Map } from 'immutable';
import { SWITCH_VISUAL_MODE } from '../actions/editor';
const editor = (state = Map({ useVisualMode: true, registeredComponents: List() }), action) => {
const editor = (state = Map({ useVisualMode: true }), action) => {
switch (action.type) {
case SWITCH_VISUAL_MODE:
return state.setIn(['useVisualMode'], action.payload);
case REGISTER_COMPONENT:
return state.updateIn(['registeredComponents'], list => list.push(action.payload));
default:
return state;
}