MCPcopy Create free account
hub / github.com/GrapesJS/react / loadEditor

Function loadEditor

packages/grapesjs-react/src/EditorInstance.tsx:98–162  ·  view source on GitHub ↗
(grapes: typeof gjs)

Source from the content-addressed store, hash-verified

96 let loadedPlugins: GrapesPlugins[] = [];
97
98 const loadEditor = (grapes: typeof gjs) => {
99 const config: EditorConfig = {
100 height: '100%',
101 ...options,
102 plugins: [...loadedPlugins, ...(options.plugins || [])],
103 pluginsOpts: {
104 ...options.pluginsOpts,
105 ...pluginOptions
106 },
107 modal: {
108 custom: !!editorOptions.customModal,
109 ...options.modal
110 },
111 assetManager: {
112 custom: !!editorOptions.customAssets,
113 ...options.assetManager
114 },
115 styleManager: {
116 custom: !!editorOptions.customStyles,
117 ...options.styleManager
118 },
119 blockManager: {
120 custom: !!editorOptions.customBlocks,
121 ...options.blockManager
122 },
123 richTextEditor: {
124 custom: !!editorOptions.customRte,
125 ...options.richTextEditor
126 },
127 layerManager: {
128 custom: !!editorOptions.customLayers,
129 ...options.layerManager
130 },
131 traitManager: {
132 custom: !!editorOptions.customTraits,
133 ...options.traitManager
134 },
135 selectorManager: {
136 custom: !!editorOptions.customSelectors,
137 ...options.selectorManager
138 },
139 container: canvasContainer || defaultContainer,
140 customUI: !!canvasContainer,
141 // Disables all default panels if Canvas is used
142 ...(canvasContainer
143 ? {
144 panels: { defaults: [] }
145 }
146 : {})
147 };
148 editor = grapes.init(config);
149 setEditor(editor);
150 onEditor(editor);
151
152 if (onUpdate) {
153 editor.on('update', () => {
154 onUpdate(editor!.getProjectData(), editor!);
155 });

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected