Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions en/Plugins/Editor/View plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.