diff --git a/en/Plugins/Editor/View plugins.md b/en/Plugins/Editor/View plugins.md index deceb503..6b9fd337 100644 --- a/en/Plugins/Editor/View plugins.md +++ b/en/Plugins/Editor/View plugins.md @@ -49,6 +49,19 @@ The three methods of the view plugin control its lifecycle: While the view plugin in the example works, it doesn't do much. If you want to better understand what causes the plugin to update, you can add a `console.log(update);` line to the `update()` method to print all updates to the console. +## Passing root plugin's settings to a view plugin + +If you need to reference your plugin's settings inside of a view plugin, define the view plugin class in a location where the settings are in scope (e.g. inside the root's `onload()` instead of the top-level scope) so the definition can enclose them. + +```JS +const viewPlugin = ViewPlugin.fromClass( + class { + // use settings wherever needed + } +); + +this.registerEditorExtension(viewPlugin); +``` ## Next steps Provide [[Decorations]] from your view plugin to change how to display the document.