windingwind/zotero-plugin-template

Does preferences.xul create a preference pane?

whacked opened this issue · 4 comments

Testing out this repository from scratch:

  1. clone repository (bootstrap branch)
  2. npm install
  3. npm run build
  4. manually install the xpi into Zotero

Everything works smoothly. After installation, right-clicking on an entry shows the Zotero Template menu item; clicking the menu item shows an alert box with "Hello World". Is this the full extent of the example?

I trying to see if I can add a preferences pane into the main Preferences window (Edit -> Preferences). I realize this is an XUL method and may be phased out in Zotero 7, but I don't see another way to do it, and your repository does add it to the XPI bundle.

Reading the XUL file seems to imply that it should show up, but it doesn't. Can you clarify this for me?

Also, in the current xul file https://github.com/windingwind/zotero-addon-template/blob/bootstrap/addon/chrome/content/preferences.xul#L9 there are many attributes with spaces in them. I don't know if this affects functionality at all; FWIW, I removed all extra spaces and nothing changed.

Thank you

Thanks for your patient test!

  1. This template used to contain two examples(a menu item and a pref pane). However, as the overlay mode will be removed in Zo7, the traditional way of adding content to the current pref window, which is possibly be removed in the future, is not recommended and no longer available in bootstrap mode. So there is only one example, the item menu Hello World. You are right.
  2. The preference.xul no longer works in bootstrap mode. I keep it just in case we'll have similar APIs or technichs to use the pref things in Zo7. Currently I don't have more information about that and cannot help. What we can do is waiting for Zotero team providing more information about Zo7.
  3. Some attributes might be useless. Some of them are from very old codes and the docs of XUL is out-dated and incomplete. It doesn't matter because we don't use them in the future.

If you want to add things to the current pref window(may be removed in Zo7) anyway, I suggest to listen to the new windows like
https://github.com/windingwind/zotero-addon-template/blob/51bbc58590ecd1ecefc0c6d590586be7eff3ce0e/addon/bootstrap.js#L44
and add contents using the window load event.

A current workaroud is to open a new window for your pref settings when clicking a menu item, like
https://github.com/windingwind/zotero-better-notes/blob/d55d03edb8936da8d9934582d5214762b33fb2bf/src/template.ts#L76

That would be an once and for all solution. However, I suggest that plugins better put their settings in one place, the pref window, to let users find settings easily.

Thanks for the explanation.

To me, it the Preferences panel is the most natural place to put a plugin's configuration, even though I understand the risk that it will get crowded.

So until the next version's solution is available, I think I will have to keep using the overlay method.

Between the first beta of Zoter 7 and its final release would be about a year I guess. So we will have plenty of time to do the migration to bootstrap.
As for the pref window in Zo7, it is likely to be totally replaced by a HTML-based page, instead of the XUL-based one. And there will be APIs for plugins, according to the discussions in dev forums.

I've made the bootstrap plugin template able to create preferences on both Zotero 6 and 7.

See https://github.com/windingwind/zotero-addon-template#preference-for-both-zotero-6-and-zotero-7-all-in-bootstrap