Access to Preference Pane after loading

41 views
Skip to first unread message

John K

unread,
Dec 1, 2025, 2:28:21 PM12/1/25
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 AM12/2/25
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 AM12/2/25
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 AM12/2/25
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 AM12/2/25
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.

johnko...@gmail.com

unread,
Jan 12, 2026, 11:36:36 AM (8 days ago) Jan 12
to zotero-dev
Yes, mate, I read the documentation first, but it is not any clearer. That's why I am asking.

The link you provided doesn't mention whether prefs.js should be in the preference pane or not. I don't think I said that.

Anyway, still can't make the onload method to fire in Zotero 7

XY Wong

unread,
Jan 12, 2026, 12:07:12 PM (8 days ago) Jan 12
to zotero-dev
It would be helpful to share your repo if possible; otherwise, we'll need a more detailed description about how you place those script files.

XY Wong

unread,
Jan 12, 2026, 12:10:43 PM (8 days ago) Jan 12
to zotero-dev
> I have it in the root dir where prefs.js is.
> The link you provided doesn't mention whether prefs.js should be in the preference pane or not. I don't think I said that.

Just wanted to say the `prefs.js` is nothing to do with the preference window (that's why it's not mentioned in the link above - it's completely a different thing). I mentioned those because I thought you might get confused by their names... 
Reply all
Reply to author
Forward
0 new messages