Skip to content

Commit

Permalink
fix: template reset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Jun 12, 2022
1 parent 466a212 commit 092a628
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AddonTemplate extends AddonBase {
},
{
name: "[QuickBackLink]",
text: '<p>Referred in <a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)}" rel="noopener noreferrer nofollow">${noteItem.getNoteTitle().trim() ? noteItem.getNoteTitle().trim() : "Main Note"}</a></p>',
text: '<p>Referred in <a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)}?ignore=1" rel="noopener noreferrer nofollow">${noteItem.getNoteTitle().trim() ? noteItem.getNoteTitle().trim() : "Main Note"}</a></p>',
disabled: false,
},
{
Expand Down Expand Up @@ -251,7 +251,7 @@ class AddonTemplate extends AddonBase {
if (this._systemTemplateNames.includes(name)) {
const text: XUL.Textbox =
this._window.document.getElementById("editor-textbox");
text.value = this.getTemplateText(name);
text.value = this._defaultTemplates.find((t) => t.name === name).text;
this._Addon.views.showProgressWindow(
"Better Notes",
`Template ${name} is reset. Please save before leaving.`
Expand All @@ -268,7 +268,7 @@ class AddonTemplate extends AddonBase {
Zotero.debug(`renderTemplate: ${key}`);
let templateText = this.getTemplateText(key);
if (useDefault && !templateText) {
templateText = this._defaultTemplates[key];
templateText = this._defaultTemplates.find((t) => t.name === key).text;
if (!templateText) {
return "";
}
Expand Down

0 comments on commit 092a628

Please sign in to comment.