From d188ffd58bcd19c2c88ecbe853d2d1b53cf61380 Mon Sep 17 00:00:00 2001 From: xiangyu <3170102889@zju.edu.cn> Date: Wed, 15 Jun 2022 23:15:04 +0800 Subject: [PATCH] fix: QuickBackLink template bug auto-fix --- src/template.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/template.ts b/src/template.ts index 177cda4..9cbf287 100644 --- a/src/template.ts +++ b/src/template.ts @@ -75,11 +75,14 @@ class AddonTemplate extends AddonBase { Zotero.Prefs.clear("Knowledge4Zotero.noteTemplate"); } // Convert buggy template - if ( - this.getTemplateText("[QuickBackLink]") === - '
Referred in ${noteItem.getNoteTitle().trim() ? noteItem.getNoteTitle().trim() : "Main Note"}
' - ) { - this.setTemplate(this._defaultTemplates["[QuickBackLink]"]); + if (!this.getTemplateText("[QuickBackLink]").includes("ignore=1")) { + this.setTemplate( + this._defaultTemplates.find((t) => t.name === "[QuickBackLink]") + ); + this._Addon.views.showProgressWindow( + "Better Notes", + "The [QuickBackLink] is reset because of missing ignore=1 in link." + ); } let templateKeys = this.getTemplateKeys(); const currentNames = templateKeys.map((t) => t.name);