2020-10-21 01:23:55 +02:00
|
|
|
import Plugin from '../Plugin';
|
|
|
|
import { ViewHandle } from './types';
|
|
|
|
/**
|
2020-11-13 19:09:28 +02:00
|
|
|
* Allows creating and managing view panels. View panels currently are
|
|
|
|
* displayed at the right of the sidebar and allows displaying any HTML
|
|
|
|
* content (within a webview) and update 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.
|
2020-10-21 01:23:55 +02:00
|
|
|
*
|
2020-11-13 19:09:28 +02:00
|
|
|
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc)
|
2020-10-21 01:23:55 +02:00
|
|
|
*/
|
|
|
|
export default class JoplinViewsPanels {
|
|
|
|
private store;
|
|
|
|
private plugin;
|
|
|
|
constructor(plugin: Plugin, store: any);
|
|
|
|
private controller;
|
|
|
|
/**
|
|
|
|
* Creates a new panel
|
|
|
|
*/
|
2020-11-13 19:09:28 +02:00
|
|
|
create(id: string): Promise<ViewHandle>;
|
2020-10-21 01:23:55 +02:00
|
|
|
/**
|
|
|
|
* Sets the panel webview HTML
|
|
|
|
*/
|
|
|
|
setHtml(handle: ViewHandle, html: string): Promise<string>;
|
|
|
|
/**
|
|
|
|
* Adds and loads a new JS or CSS files into the panel.
|
|
|
|
*/
|
|
|
|
addScript(handle: ViewHandle, scriptPath: string): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Called when a message is sent from the webview (using postMessage).
|
|
|
|
*/
|
|
|
|
onMessage(handle: ViewHandle, callback: Function): Promise<void>;
|
2021-01-02 15:32:15 +02:00
|
|
|
/**
|
|
|
|
* Shows the panel
|
|
|
|
*/
|
|
|
|
show(handle: ViewHandle, show?: boolean): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Hides the panel
|
|
|
|
*/
|
|
|
|
hide(handle: ViewHandle): Promise<void>;
|
|
|
|
/**
|
|
|
|
* Tells whether the panel is visible or not
|
|
|
|
*/
|
|
|
|
visible(handle: ViewHandle): Promise<boolean>;
|
2020-10-21 01:23:55 +02:00
|
|
|
}
|