convert editor component registry to Map
This commit is contained in:
parent
adcb215fbd
commit
5048c7ca1d
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user