From 8c45b867ccbbe6efa76bf7cdfb79c6223c951776 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 25 May 2026 11:19:21 +0400 Subject: [PATCH] Update plugin docs --- docs/modules/Plugins.md | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/modules/Plugins.md b/docs/modules/Plugins.md index 723b842d8..5c0918acf 100644 --- a/docs/modules/Plugins.md +++ b/docs/modules/Plugins.md @@ -112,20 +112,20 @@ This is useful when: const editor = grapesjs.init({ // ... plugins: [ - // Load plugin with id... - { id: 'my-plugin', plugin: usePlugin(myPlugin, { opt1: 'A' }) } + // Load plugin on init... + { id: 'my-plugin-1', plugin: usePlugin(myPlugin, { opt1: 'A' }) } ], }); // ... or add it dynamically const plugin = editor.Plugins.add({ - id: 'my-plugin', + id: 'my-plugin-2', plugin: usePlugin(myPlugin, { opt1: 'A' }), }); -const hasPlugin = !!editor.Plugins.get('my-plugin'); +const hasPlugin = !!editor.Plugins.get('my-plugin-2'); editor.Plugins.getAll(); -editor.Plugins.remove('my-plugin'); +editor.Plugins.remove('my-plugin-2'); ``` GrapesJS stores active plugins inside `editor.Plugins` module, so the plugin can be identified and removed later. @@ -139,12 +139,6 @@ editor.Plugins.add({ }); ``` -If you don't need the descriptor form, plain plugin functions still work as before. - -```ts -editor.Plugins.add(myPlugin); -``` - When possible, GrapesJS also tracks editor-level entities added during plugin execution and removes them automatically when the plugin is removed. This currently applies to runtime/editor configuration features such as blocks, component types, keymaps, etc. The automatic cleanup is intentionally limited to editor-level registrations. It does not remove project data such as pages, components already added to the canvas, or any other persisted content.