{productname} allows developers to create custom views and attach them to the main editor view. This feature enables the creation of additional UI components that can be toggled on or off. When toggled on, the custom view replaces the editor, providing a distinct visual space for specialized functionality.
The addView API in the editor’s UI registry allows developers to register new view containers. These containers are initially hidden (off) and attached next to the main view. The visibility of these custom views can be toggled using the ToggleView command. The state of the custom view can be queried using the queryCommandValue method.
This is the syntax for the addView function: editor.ui.registry.addView(name: String, obj: View.ViewSpec)
| Parameter | Type | Description |
|---|---|---|
|
|
The |
|
|
The |
| Property | Type | Description |
|---|---|---|
|
|
The |
|
|
The |
|
|
The |
To toggle the custom view, you can use the ToggleView command. Here is an example of how to use it:
// Assuming 'myCustomView' is the name of your custom view
editor.execCommand('ToggleView', false, 'myCustomView');