From f6192496c23908fc185d6c1641963dcbcaaa0e69 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 14 Oct 2020 19:35:13 -0400 Subject: Fix template updates for multiple declarations (#918) * Update pattern to be multi-match * Remove unnecessary async --- ext/bg/js/options.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 19a5cc2c..42a1f3d4 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -380,13 +380,13 @@ class OptionsUtil { if (addition === null) { addition = await this._fetchAsset(additionSourceUrl); } - profileOptions.anki.fieldTemplates = await this._addFieldTemplatesBeforeEnd(fieldTemplates, addition); + profileOptions.anki.fieldTemplates = this._addFieldTemplatesBeforeEnd(fieldTemplates, addition); } } } - async _addFieldTemplatesBeforeEnd(fieldTemplates, addition) { - const pattern = /[ \t]*\{\{~?>\s*\(\s*lookup\s*\.\s*"marker"\s*\)\s*~?\}\}/; + _addFieldTemplatesBeforeEnd(fieldTemplates, addition) { + const pattern = /[ \t]*\{\{~?>\s*\(\s*lookup\s*\.\s*"marker"\s*\)\s*~?\}\}/g; const newline = '\n'; let replaced = false; fieldTemplates = fieldTemplates.replace(pattern, (g0) => { -- cgit v1.2.3