Skip to content

Commit

Permalink
fix: workspace template menu bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed May 21, 2022
1 parent 2015800 commit 9a1200b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 11 additions & 7 deletions src/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 9a1200b

Please sign in to comment.