MCPcopy
hub / github.com/udecode/plate / configureNestedPlugin

Function configureNestedPlugin

packages/core/src/lib/plugin/createSlatePlugin.ts:157–186  ·  view source on GitHub ↗
(
      plugins: SlatePlugins
    )

Source from the content-addressed store, hash-verified

155 const newPlugin = { ...plugin };
156
157 const configureNestedPlugin = (
158 plugins: SlatePlugins
159 ): { found: boolean; plugins: SlatePlugins } => {
160 let found = false;
161
162 const updatedPlugins = plugins.map((nestedPlugin) => {
163 if (nestedPlugin.key === p.key) {
164 found = true;
165
166 return createSlatePlugin({
167 ...nestedPlugin,
168 __configuration: (ctx: any) =>
169 isFunction(config) ? config(ctx) : config,
170 } as any);
171 }
172 if (nestedPlugin.plugins && nestedPlugin.plugins.length > 0) {
173 const result = configureNestedPlugin(nestedPlugin.plugins);
174
175 if (result.found) {
176 found = true;
177
178 return { ...nestedPlugin, plugins: result.plugins };
179 }
180 }
181
182 return nestedPlugin;
183 });
184
185 return { found, plugins: updatedPlugins };
186 };
187
188 const result = configureNestedPlugin(newPlugin.plugins as any);
189 newPlugin.plugins = result.plugins as any;

Callers 1

createSlatePluginFunction · 0.85

Calls 2

isFunctionFunction · 0.90
createSlatePluginFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…