Zotero : object
Kind: global namespace
- Zotero :
object- .PreferencePanes
- .register(options) ⇒
Promise.<string> - .unregister(id)
- .register(options) ⇒
- .PreferencePanes
Zotero.PreferencePanes
Manages preference panes.
Kind: static property of Zotero
- .PreferencePanes
- .register(options) ⇒
Promise.<string> - .unregister(id)
- .register(options) ⇒
PreferencePanes.register(options) ⇒ Promise.<string>
Register a pane to be displayed in the preferences. The pane XHTML (src) is loaded as a fragment, not a full document, with XUL as the default namespace and (X)HTML tags available under html:.
The pane will be unregistered automatically when the registering plugin shuts down.
Kind: static method of PreferencePanes
Returns: Promise.<string> - Resolves to the ID of the pane if successfully added
| Param | Type | Description |
|---|---|---|
| options | Object | |
| options.pluginID | string | ID of the plugin registering the pane |
| options.src | string | URI of an XHTML fragment, optionally relative to the plugin's root |
| [options.id] | string | Represents the pane and must be unique. Automatically generated if not provided |
| [options.parent] | string | ID of parent pane (if provided, pane is hidden from the sidebar) |
| [options.label] | string | Displayed as the pane's label in the sidebar. If not provided, the plugin's name is used |
| [options.image] | string | URI of an icon to be displayed in the navigation sidebar, optionally relative to the plugin's root. If not provided, the plugin's icon (from manifest.json) is used. |
| [options.scripts] | Array.<string> | Array of URIs of scripts to load along with the pane, optionally relative to the plugin's root |
| [options.stylesheets] | Array.<string> | Array of URIs of CSS stylesheets to load along with the pane, optionally relative to the plugin's root |
| [options.helpURL] | string | If provided, a help button will be displayed under the pane and the provided URL will open when it is clicked |
Example
Register a pane with a script and stylesheet:
javascript
Zotero.PreferencePanes.register({
pluginID: "my-plugin@my-namespace.com",
src: `${rootURI}my-pane.xhtml`,
id: "my-plugin-pane",
scripts: [`${rootURI}my-pane.js`],
stylesheets: [`${rootURI}my-pane.css`],
});PreferencePanes.unregister(id)
Called automatically on plugin shutdown.
Kind: static method of PreferencePanes
| Param | Type | Description |
|---|---|---|
| id | string | ID of the pane to unregister, as returned by Zotero.PreferencePanes.register() |