(
plugins: SlatePlugins
)
| 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; |
no test coverage detected
searching dependent graphs…