Fix not working context menu options to create note from annotations

This commit is contained in:
Martynas Bagdonas 2023-06-30 10:52:25 +03:00
parent f447a4953a
commit fcb30b5e5d

View file

@ -3346,16 +3346,12 @@ var ZoteroPane = new function()
// If all from a single item, show "Add Note from Annotations" // If all from a single item, show "Add Note from Annotations"
if (Zotero.Items.getTopLevel(items).length == 1) { if (Zotero.Items.getTopLevel(items).length == 1) {
key = 'addNoteFromAnnotations'; key = 'addNoteFromAnnotations';
menuitem.onclick = async () => { menuitem.setAttribute('oncommand', 'ZoteroPane.addNoteFromAnnotationsFromSelected()');
return this.addNoteFromAnnotationsFromSelected();
};
} }
// Otherwise show "Create Note from Annotations" // Otherwise show "Create Note from Annotations"
else { else {
key = 'createNoteFromAnnotations'; key = 'createNoteFromAnnotations';
menuitem.onclick = async () => { menuitem.setAttribute('oncommand', 'ZoteroPane.createStandaloneNoteFromAnnotationsFromSelected()');
return this.createStandaloneNoteFromAnnotationsFromSelected();
};
} }
menuitem.setAttribute( menuitem.setAttribute(
'label', 'label',
@ -3443,16 +3439,12 @@ var ZoteroPane = new function()
// Show "Create" on standalone attachments // Show "Create" on standalone attachments
if (item.isAttachment() && item.isTopLevelItem()) { if (item.isAttachment() && item.isTopLevelItem()) {
str = 'pane.items.menu.createNoteFromAnnotations'; str = 'pane.items.menu.createNoteFromAnnotations';
menuitem.onclick = async () => { menuitem.setAttribute('oncommand', 'ZoteroPane.createStandaloneNoteFromAnnotationsFromSelected()');
return this.createStandaloneNoteFromAnnotationsFromSelected();
};
} }
// And "Add" otherwise // And "Add" otherwise
else { else {
str = 'pane.items.menu.addNoteFromAnnotations'; str = 'pane.items.menu.addNoteFromAnnotations';
menuitem.onclick = async () => { menuitem.setAttribute('oncommand', 'ZoteroPane.addNoteFromAnnotationsFromSelected()');
return this.addNoteFromAnnotationsFromSelected();
};
} }
menuitem.setAttribute('label', Zotero.getString(str)); menuitem.setAttribute('label', Zotero.getString(str));
} }