Display itemmenu icon in bootstrapped plugin

47 views
Skip to first unread message

Annabelle Wiegart

unread,
Nov 17, 2023, 4:00:35 AM11/17/23
to zotero-dev
Hi,
I am adapting an existing Zotero plugin to be a bootstrapped plugin for Zotero 6 and 7. The plugin looks up local library holdings for the selected items. It adds a right-click menu item "Check UZB holdings". Next to the menu item label, I would like to display a looking glass icon. This has worked in the overlay version of the plugin: https://github.com/NbtKmy/ZoteroAddonForUBB1/blob/main/chrome/content/overlay.xul. However, in the bootstrapped version, I don't get the icon to display. I'm following the instructions on https://www.zotero.org/support/dev/zotero_7_for_developers and taking the Make-it-red plugin as a template. But make-it-red does not include an icon. I included this in my manifest.json:

"icons": {
    "48": "glass.png",
    "96": "glass.png"
},

with glass.png saved at the root directory of the plugin, at the same level as manifest.json. Is this the right approach at all? And how do I reference the defined icon in my plugin's JS code? I tried 

menuitem.setAttribute('image', 'glass_48.png');

but that does not work. Any help appreciated!

Annabelle Wiegart

unread,
Nov 17, 2023, 4:37:35 AM11/17/23
to zotero-dev
...I just seem to have solved the problem by adding 'rootURI+' to the image file path.
Reply all
Reply to author
Forward
0 new messages