preference in zotero 6 and 7

84 views
Skip to first unread message

linxz...@gmail.com

unread,
Aug 21, 2023, 11:21:50 PM8/21/23
to zotero-dev
Hi,

I found a preference default setting problem when the user updates from Zotero 6 to 7. I discovered that most plugins use the prefix "extensions.zotero." to name their preferences.. They may have referred to the same plugin when making a plugin.

In Zotero7, the [official document](https://www.zotero.org/support/dev/zotero_7_for_developers#default_preferences) recommends to use ` pref("extensions.make-it-red.intensity", 100);` in `prefs.js`. The prefix of preference is `extensions.pluginname.`. The default preference values will be loaded from the `prefs.js` when started and removed when uninstalled.

But I found they are not compatible with Zotero6's preferences which have a prefix of " extensions.zotero. ". When a user updates from Zotero 6 to 7, the old preferences persist. If they install a plugin for Zotero 7 with preferences starting with "extensions.zotero." , newly added preferences' default values will not be loaded.

I think I can manually load default preferences when the plugin startup. Maybe I can find another solution to this problem.


Dan Stillman

unread,
Aug 22, 2023, 1:34:32 AM8/22/23
to zoter...@googlegroups.com
On 8/21/23 11:21 PM, linxz...@gmail.com wrote:
> If they install a plugin for Zotero 7 with preferences starting with
> "extensions.zotero." , newly added preferences' default values will
> not be loaded.

I'm not sure what you mean by this part. Zotero 7 should load any prefs
in prefs.js, regardless of prefix.

There's no technical difference between `extensions.zotero.` and
`extensions.[plugin-name]`. We do recommend `extensions.[plugin-name]`,
and if you switch to that you could migrate your old prefs over from
`extensions.zotero.`.

To be clear, if you're using Zotero.Prefs.get(pref, global)/set(pref,
value, global), you need to pass `true` for the `global` parameter if
you're using something other than `extensions.zotero.`, and you need to
pass the full name of your pref.

linxz...@gmail.com

unread,
Aug 22, 2023, 4:52:09 AM8/22/23
to zotero-dev
Hi Dan, Thank you for your reply. 
I think I should add code to migrate preferences from Zotero 6 to 7.

Lin
Reply all
Reply to author
Forward
0 new messages