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