fix: workspace template menu bug

This commit is contained in:
xiangyu 2022-05-22 00:43:30 +08:00
parent 2015800465
commit 9a1200b585
3 changed files with 13 additions and 9 deletions

View File

@ -3,7 +3,7 @@
"addonName": "Zotero Better Notes",
"addonID": "Knowledge4Zotero@windingwind.com",
"addonRef": "Knowledge4Zotero",
"version": "0.3.0",
"version": "0.3.1",
"description": "Everything about note management. All in Zotero.",
"main": "src/index.js",
"scripts": {

View File

@ -648,13 +648,17 @@ class AddonViews extends AddonBase {
const menuitem = _window.document.createElement("menuitem");
menuitem.setAttribute("id", template.name);
menuitem.setAttribute("label", template.name);
menuitem.addEventListener("click", (e) => {
this._Addon.events.onEditorEvent(
new EditorMessage(`insert${type}UsingTemplate`, {
params: { templateName: template.name },
})
);
});
menuitem.setAttribute(
"oncommand",
`
Zotero.Knowledge4Zotero.events.onEditorEvent({
type: "insert${type}UsingTemplate",
content: {
params: { templateName: "${template.name}" },
},
});`
);
if (template.disabled) {
menuitem.setAttribute("disabled", true);
}

View File

@ -5,7 +5,7 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>0.3.0</em:version>
<em:version>0.3.1</em:version>
<em:targetApplication>
<rdf:Description>
<em:id>zotero@chnm.gmu.edu</em:id>