From a72c3d7719cafcbf0ccd17b24c8c7108743ef1a7 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/bg/js') 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