static-cms/src/lib/registry.js

37 lines
921 B
JavaScript
Raw Normal View History

import {List} from 'immutable';
import {newEditorPlugin} from '../components/Widgets/MarkdownControlElements/plugins';
2016-09-11 23:08:18 +02:00
const _registry = {
templates: {},
2016-09-11 23:08:18 +02:00
previewStyles: [],
widgets: {},
editorComponents: List([])
};
2016-09-11 23:08:18 +02:00
export default {
registerPreviewStyle(style) {
_registry.previewStyles.push(style);
},
registerPreviewTemplate(name, component) {
_registry.templates[name] = component;
},
getPreviewTemplate(name) {
return _registry.templates[name];
},
getPreviewStyles() {
return _registry.previewStyles;
},
registerWidget(name, control, preview) {
_registry.widgets[name] = { control, preview };
},
getWidget(name) {
return _registry.widgets[name];
},
registerEditorComponent(component) {
_registry.editorComponents = _registry.editorComponents.push(newEditorPlugin(component));
},
getEditorComponents() {
return _registry.editorComponents;
2016-09-11 23:08:18 +02:00
}
};