Skip to content

v0.1.3

Choose a tag to compare

@cannolis cannolis released this 08 May 10:34
· 6 commits to main since this release

ZotRead v0.1.3 — really, actually, fix prefs blank labels

After v0.1.1 and v0.1.2 both failed to fix the blank-prefs-on-first-install issue (one made it worse, the other had no effect), I dug into how proven Zotero plugins like zotero-better-notes and zotero-pdf-translate structure their preferences.xhtml. The root cause was finally clear:

What was wrong

Our preferences.xhtml triggered the load hook via <groupbox onload="...">. This pattern stopped working reliably in Zotero 9's prefs framework — the onload event on the groupbox doesn't fire in time (or at all) on a fresh-profile open, so registerPrefsScripts never ran, FTL never got translated, and labels stayed blank.

Zotero-better-notes (the most-used Zotero plugin) uses a <script> block directly inside the prefs document to invoke the load hook synchronously when the document parses. Switched to that pattern.

What changed

addon/content/preferences.xhtml:

 <linkset>
   <html:link rel="localization" href="__addonRef__-preferences.ftl" />
 </linkset>
-<groupbox
-  onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', { window })"
->
+<script>
+  Zotero.__addonInstance__.hooks.onPrefsEvent("load", { window });
+</script>
+<groupbox>

The v0.1.2 preheat (insertFTLIfNeeded for prefs FTL on main window load) is kept as a belt-and-suspenders measure but is no longer the primary mechanism.

Install

Same as before — download the new zot-read.xpi and re-install via Tools → Add-ons → gear icon → Install Add-on From File…. Settings preserved.

If v0.1.3 still shows blank labels on a fresh profile, please open Zotero's Tools → Developer → Run JavaScript and paste:

Zotero.debug("[ZotRead] manual debug: " + JSON.stringify(Object.keys(Zotero.ZotRead || {})));

Then send me the output of /tmp/zotero-win.log — that lets me see whether the prefs hook fired at all.