fix: read prefs content via http bug
This commit is contained in:
parent
e1bb4d8787
commit
5adb1444d8
@ -108,12 +108,19 @@ class AddonUtils extends AddonModule {
|
|||||||
this.Tool.log("registerPrefPane:detected", options);
|
this.Tool.log("registerPrefPane:detected", options);
|
||||||
const Zotero = this.Compat.getZotero();
|
const Zotero = this.Compat.getZotero();
|
||||||
options.id || (options.id = `plugin-${new Date().getTime()}`);
|
options.id || (options.id = `plugin-${new Date().getTime()}`);
|
||||||
|
const contenrOrXHR = await Zotero.File.getContentsAsync(
|
||||||
|
options.src
|
||||||
|
);
|
||||||
|
const content =
|
||||||
|
typeof contenrOrXHR === "string"
|
||||||
|
? contenrOrXHR
|
||||||
|
: (contenrOrXHR as any as XMLHttpRequest).response;
|
||||||
const src = `<prefpane id="${
|
const src = `<prefpane id="${
|
||||||
options.id
|
options.id
|
||||||
}" insertafter="zotero-prefpane-advanced" label="${
|
}" insertafter="zotero-prefpane-advanced" label="${
|
||||||
options.label || options.pluginID
|
options.label || options.pluginID
|
||||||
}" image="${options.image || ""}">
|
}" image="${options.image || ""}">
|
||||||
${(await Zotero.File.getContentsAsync(options.src)) as string}
|
${content}
|
||||||
</prefpane>`;
|
</prefpane>`;
|
||||||
const frag = this.Compat.parseXHTMLToFragment(
|
const frag = this.Compat.parseXHTMLToFragment(
|
||||||
src,
|
src,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user