Skip to content

Commit

Permalink
change: accept [item]/[text] as template name
Browse files Browse the repository at this point in the history
  • Loading branch information
windingwind committed Jun 11, 2023
1 parent f2d3c81 commit 5775e05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/modules/template/picker.ts
Expand Up @@ -80,7 +80,7 @@ async function insertTemplateCallback(name: string) {
addon.data.templatePicker.data.noteId || addon.data.workspace.mainId
);
let html = "";
if (name.startsWith("[Item]")) {
if (name.toLowerCase().startsWith("[item]")) {
html = await addon.api.template.runItemTemplate(name, {
targetNoteId: targetNoteItem.id,
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/template/preview.ts
Expand Up @@ -11,11 +11,11 @@ async function renderTemplatePreview(
if (!inputItems) {
inputItems = ZoteroPane.getSelectedItems();
}
if (templateName.startsWith("[Text]")) {
if (templateName.toLowerCase().startsWith("[text]")) {
html = await addon.api.template.runTextTemplate(templateName, {
dryRun: true,
});
} else if (templateName.startsWith("[Item]")) {
} else if (templateName.toLowerCase().startsWith("[item]")) {
const data = inputItems?.map((item) => item.id);
html = await addon.api.template.runItemTemplate(templateName, {
itemIds: data,
Expand Down

0 comments on commit 5775e05

Please sign in to comment.