Adds and loads a new JS or CSS files into the panel.
Creates a new panel
Hides the panel
Called when a message is sent from the webview (using postMessage).
To post a message from the webview to the plugin use:
const response = await webviewApi.postMessage(message);
message
can be any JavaScript object, string or numberresponse
is whatever was returned by the onMessage
handlerUsing this mechanism, you can have two-way communication between the plugin and webview.
See the postMessage demo for more details.
Sends a message to the webview.
The webview must have registered a message handler prior, otherwise the message is ignored. Use;
webviewApi.onMessage((message) => { ... });
message
can be any JavaScript object, string or numberThe view API may have only one onMessage handler defined. This method is fire and forget so no response is returned.
It is particularly useful when the webview needs to react to events emitted by the plugin or the joplin api.
Sets the panel webview HTML
Shows the panel
Tells whether the panel is visible or not
Allows creating and managing view panels. View panels allow displaying any HTML content (within a webview) and updating it in real-time. For example it could be used to display a table of content for the active note, or display various metadata or graph.
On desktop, view panels currently are displayed at the right of the sidebar, though can be moved with "View" > "Change application layout".
On mobile, view panels are shown in a tabbed dialog that can be opened using a toolbar button.
View the demo plugin