get document from contextPane

41 views
Skip to first unread message

Emiliano Heyns

unread,
Jun 8, 2022, 2:51:41 AM6/8/22
to zotero-dev
I want to add the BBT citekey to the contextPane, for which I need to know when it's being build, and I need access to the `document` when adding BBT content. Anyone have any idea how to do this? Normally I'd use an overlay, but that's not available here.

Martynas Bagdonas

unread,
Jun 8, 2022, 3:20:43 AM6/8/22
to zotero-dev
Could you explain where exactly you want to add that additional content into contextPane? Or even show in a screenshot.

Martynas Bagdonas

unread,
Jun 8, 2022, 4:17:39 AM6/8/22
to zotero-dev
Ok, if I understand correctly you want citekey to appear before the item box, as it is in the library view tab. Info pane is initialised here.

I might help more if you point me to the code that is inserting the content.

Emiliano Heyns

unread,
Jun 8, 2022, 5:48:00 PM6/8/22
to zotero-dev
The code addition starts at https://github.com/retorquere/zotero-better-bibtex/blob/master/content/ItemPane.xul#L12, but that's mostly done by the overlay, that won't work for the contextPane. The first thing I'd need to know is how to get called after that init runs. I usually do this with monkey-patches started from an overlay; that gives me a trigger whenever the pane is loaded, and I get access to `document`, but since contextPane is not loaded as a xul pane, I don't know where to start.

This goes more for more places in Zotero for me. I'm looking to convert to restartless, where I have the same problem with other panes that I currently start from an overlay.

Martynas Bagdonas

unread,
Jun 9, 2022, 4:43:35 AM6/9/22
to zotero-dev
The best would be if you insert the necessary content directly into itemBox, not itemPane. This way it would automatically work in contextPane as well.

Otherwise you would need to insert you content after each call of _addItemContext which is in ZoteroContextPane, but at the moment it's private and can't be monkey-patched.

Emiliano Heyns

unread,
Jun 9, 2022, 10:45:16 AM6/9/22
to zotero-dev
I have tried previously to add it to the itembox (which is pretty hard to reach in to BTW as it's an XBL binding), but Zotero did not like it *at all* to find unexpected textfields there, and since the field list was continuously being rebuilt, it was hard to keep the field there. But even if I did that, what would be the trigger for me to do this? I'd still use the ItemPane overlay load to get the trigger and get access to the `document` to start adding this content. I don't know how I'd do that for the contextPane.
Reply all
Reply to author
Forward
0 new messages