diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-10-14 19:35:13 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-10-14 19:42:59 -0400 |
commit | f6192496c23908fc185d6c1641963dcbcaaa0e69 (patch) | |
tree | 64f04d8271b838bcebc94c71f0af1dc87b85ea20 | |
parent | 8058e491fe7e5f2d345d7a60dbfa906da72176c8 (diff) |
Fix template updates for multiple declarations (#918)
* Update pattern to be multi-match
* Remove unnecessary async
-rw-r--r-- | ext/bg/js/options.js | 6 |
1 files changed, 3 insertions, 3 deletions
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) => { |