Access to Preference Pane after loading

19 views
Skip to first unread message

John K

unread,
Dec 1, 2025, 2:28:21 PM (4 days ago) Dec 1
to zotero-dev
Hi there, 

I am writing a plugin that adds a preference pane. This works fine. Now what I want to do is to update some labels in the pane.

So, I want to launch a functionn after the panel is loaded. 

1. I didn't manage to locate any events to do this (e.g., Zotero.PreferencePanes.register observer). Is there any?

2. Instead, in preferences.xhtml I have this:
2025-11-30 10 41 54.png

Now, I have a separate file prefs-abs.js, with the onLoad function:
2025-11-30 10 44 22.png

Should the Init() be async?

When the plugin loads, I get the following error:
2025-11-30 10 46 43.png

Obviously, Zotero can not find the definition. Where should I store prefs-abs.js? I have it in the root dir where prefs.js is.

3. Is there another way to get access to a label in the preferences pane?

Thank you for any help.




XY Wong

unread,
Dec 2, 2025, 8:31:52 AM (3 days ago) Dec 2
to zotero-dev
> I didn't manage to locate any events to do this (e.g., Zotero.PreferencePanes.register observer). Is there any?

no

> Should the Init() be async?

That doesn't matter. Async or not only decides how the logic inside your `Init` function executes in this case.

> Obviously, Zotero can not find the definition. Where should I store prefs-abs.js? I have it in the root dir where prefs.js is.

You will need to pass the path to scripts that need to be loaded when registering the pref pane. Where you store the file doesn't matter. See https://windingwind.github.io/doc-for-zotero-plugin-dev/main/preferences-pane.html

> Is there another way to get access to a label in the preferences pane?

Not sure what you mean here - please check the link above for the recommended approach.

johnko...@gmail.com

unread,
Dec 2, 2025, 9:54:08 AM (3 days ago) Dec 2
to zotero-dev
HI and thanks.

I know with the 'make it read' example.

I have tried the scripts option in register, but it doesn't work. I think there is something wrong with the way the pane loads, as it doesn't even load the prefs.js that is shown in the example.

XY Wong

unread,
Dec 2, 2025, 11:16:18 AM (3 days ago) Dec 2
to zotero-dev
I just tested the make-it-red 2.0 on Zotero 8 beta 16 and it works fine, as long as you have those files created - the repo doesn't include those files. it is just an example to show you how it is supposed to work.

XY Wong

unread,
Dec 2, 2025, 11:19:37 AM (3 days ago) Dec 2
to zotero-dev
btw, the `prefs.js` is not meant to be loaded in the preference window. see https://windingwind.github.io/doc-for-zotero-plugin-dev/main/plugin-file-structure.html#default-preferences

i would strongly suggest reading the doc first to have some understanding of how everything works, instead making guesses e.g. which file will be loaded by the file names.

Reply all
Reply to author
Forward
0 new messages