diff options
author | jbukl <148171160+jbukl@users.noreply.github.com> | 2023-11-17 11:49:58 -0500 |
---|---|---|
committer | jbukl <148171160+jbukl@users.noreply.github.com> | 2023-11-17 11:49:58 -0500 |
commit | 6290a4febc90c6fe98d37b83897432f402474ed4 (patch) | |
tree | 9883536ae384bb2765a836f83d0eb0bfe1a40bdb /ext/js/background/offscreen.js | |
parent | 9b62b8de7792eec254f8c464c2060a3ecbb40ce6 (diff) |
Fix text replacements offscreen
Diffstat (limited to 'ext/js/background/offscreen.js')
-rw-r--r-- | ext/js/background/offscreen.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/js/background/offscreen.js b/ext/js/background/offscreen.js index 2d8445d0..27cee8c4 100644 --- a/ext/js/background/offscreen.js +++ b/ext/js/background/offscreen.js @@ -116,7 +116,10 @@ export class Offscreen { if (!group) { return group; } - return group.map((opt) => ({...opt, pattern: new RegExp(opt.pattern)})); + return group.map((opt) => { + const [, pattern, flags] = opt.pattern.match(/\/(.*?)\/([a-z]*)?$/i); // https://stackoverflow.com/a/33642463 + return {...opt, pattern: new RegExp(pattern, flags ?? '')}; + }); }); return this._translator.findTerms(mode, text, findTermsOptions); } |