convert editor component registry to Map

This commit is contained in:
Shawn Erquhart 2017-05-24 15:44:54 -04:00
parent adcb215fbd
commit 5048c7ca1d
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ export default class Toolbar extends React.Component {
onLink: PropTypes.func.isRequired,
onToggleMode: PropTypes.func.isRequired,
rawMode: PropTypes.bool,
plugins: ImmutablePropTypes.listOf(ImmutablePropTypes.record),
plugins: ImmutablePropTypes.map,
onSubmit: PropTypes.func.isRequired,
onAddAsset: PropTypes.func.isRequired,
onRemoveAsset: PropTypes.func.isRequired,

View File

@ -6,7 +6,7 @@ import styles from './ToolbarComponentsMenu.css';
export default class ToolbarComponentsMenu extends React.Component {
static PropTypes = {
plugins: ImmutablePropTypes.list.isRequired,
plugins: ImmutablePropTypes.map.isRequired,
onComponentMenuItemClick: PropTypes.func.isRequired,
};

View File

@ -1,11 +1,11 @@
import { List } from 'immutable';
import { Map } from 'immutable';
import { newEditorPlugin } from '../components/Widgets/MarkdownControlElements/plugins';
const _registry = {
templates: {},
previewStyles: [],
widgets: {},
editorComponents: List([])
editorComponents: Map(),
};
export default {
@ -31,7 +31,8 @@ export default {
return _registry.widgets[name];
},
registerEditorComponent(component) {
_registry.editorComponents = _registry.editorComponents.push(newEditorPlugin(component));
const plugin = newEditorPlugin(component);
_registry.editorComponents = _registry.editorComponents.set(plugin.get('id'), plugin);
},
getEditorComponents() {
return _registry.editorComponents;