Hello,
I'm trying to add a custom menu item to the context menu when text is selected in the PDF reader, but haven't been able to get it working.
What I've tried:
The new MenuManager API - Checked the source at https://github.com/zotero/zotero/blob/main/chrome/content/zotero/xpcom/pluginAPI/menuManager.js but the VALID_TARGETS array doesn't include any targets for PDF reader content area menus.
Reader.registerEventListener with createViewContextMenu:
Zotero.Reader.registerEventListener(
'createViewContextMenu',
(event) => {
const { append } = event;
append({
label: 'My Custom Action',
onCommand: () => { /* ... */ }
});
},
'my-plugin-id'
);
The event fires but I can't access the selected text.
Annotation context menu - This works fine:
Zotero.Reader.registerEventListener(
'createAnnotationContextMenu',
(event) => { /* This works */ },
'my-plugin-id'
);
Questions:
Environment:
Zotero 8.0-beta.21+
Testing the toolbar button and annotation menus work fine, just can't get text selection menu to work
Thanks for any guidance!
--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/zotero-dev/8f7c790a-7ae7-4a2a-818c-8c47d08cb0d9n%40googlegroups.com.