Skip to content

Latest commit

 

History

History
98 lines (63 loc) · 1.75 KB

zotero-plugin-toolkit.preferencepanemanager.register.md

File metadata and controls

98 lines (63 loc) · 1.75 KB

Home > zotero-plugin-toolkit > PreferencePaneManager > register

PreferencePaneManager.register() method

Register a preference pane from an xhtml, for Zotero 6 & 7.

Signature:

register(options: PrefPaneOptions): void;

Parameters

Parameter

Type

Description

options

PrefPaneOptions

See PrefPaneOptions

**Returns:**

void

Remarks

options:

export interface PrefPaneOptions {
  pluginID: string;
  src: string;
  id?: string;
  parent?: string;
  label?: string;
  image?: string;
  extraDTD?: string[];
  scripts?: string[];
  defaultXUL?: boolean;
  // Only for Zotero 6
  onload?: (win: Window) => any;
}

Example

const prefsManager = new PreferencePaneManager();
function initPrefs() {
  const prefOptions = {
    pluginID: addonID,
    src: rootURI + "chrome/content/preferences.xhtml",
    label: "Template",
    image: `chrome://${addonRef}/content/icons/favicon.png`,
    extraDTD: [`chrome://${addonRef}/locale/overlay.dtd`],
    defaultXUL: true
  };
  prefsManager.register(prefOptions);
};

function unInitPrefs() {
  prefsManager.unregisterAll();
};

// bootstrap.js:startup initPrefs();

// bootstrap.js:shutdown unInitPrefs();