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

Function extendNestedPlugin

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

Source from the content-addressed store, hash-verified

279 const newPlugin = { ...plugin };
280
281 const extendNestedPlugin = (
282 plugins: SlatePlugins
283 ): { found: boolean; plugins: SlatePlugins } => {
284 let found = false;
285 const updatedPlugins = plugins.map((nestedPlugin) => {
286 if (nestedPlugin.key === p.key) {
287 found = true;
288
289 return createSlatePlugin({
290 ...nestedPlugin,
291 __extensions: [
292 ...(nestedPlugin.__extensions as any),
293 (ctx: any) =>
294 isFunction(extendConfig) ? extendConfig(ctx) : extendConfig,
295 ],
296 } as any);
297 }
298 if (nestedPlugin.plugins && nestedPlugin.plugins.length > 0) {
299 const result = extendNestedPlugin(nestedPlugin.plugins);
300
301 if (result.found) {
302 found = true;
303
304 return { ...nestedPlugin, plugins: result.plugins };
305 }
306 }
307
308 return nestedPlugin;
309 });
310
311 return { found, plugins: updatedPlugins };
312 };
313
314 const result = extendNestedPlugin(newPlugin.plugins as any);
315 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…