From a9ff9b57b34cc045a9a266d171ac4c6b7ecd070a Mon Sep 17 00:00:00 2001 From: Nick the Sick Date: Fri, 10 Oct 2025 16:35:26 +0200 Subject: [PATCH] feat: allow multiple plugins to be registered at once --- packages/core/src/Editor.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index bf2946dc29..65cb4fad00 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -355,13 +355,13 @@ export class Editor extends EventEmitter { * @param handlePlugins Control how to merge the plugin into the existing plugins. * @returns The new editor state */ - public registerPlugin( - plugin: Plugin, - handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[], + public registerPlugin( + plugin: T, + handlePlugins?: (newPlugin: T, plugins: Plugin[]) => Plugin[], ): EditorState { const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) - : [...this.state.plugins, plugin] + : [...this.state.plugins, ...(Array.isArray(plugin) ? plugin : [plugin])] const state = this.state.reconfigure({ plugins })