Skip to content

Zotero : object

Kind: global namespace

Zotero.PreferencePanes

Manages preference panes.

Kind: static property of Zotero

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

ParamTypeDescription
optionsObject
options.pluginIDstringID of the plugin registering the pane
options.srcstringURI of an XHTML fragment, optionally relative to the plugin's root
[options.id]stringRepresents the pane and must be unique. Automatically generated if not provided
[options.parent]stringID of parent pane (if provided, pane is hidden from the sidebar)
[options.label]stringDisplayed as the pane's label in the sidebar. If not provided, the plugin's name is used
[options.image]stringURI 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]stringIf 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

ParamTypeDescription
idstringID of the pane to unregister, as returned by Zotero.PreferencePanes.register()