diff options
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/background/offscreen-proxy.js | 2 | ||||
-rw-r--r-- | ext/js/background/offscreen.js | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/ext/js/background/offscreen-proxy.js b/ext/js/background/offscreen-proxy.js index ae414b99..c01f523d 100644 --- a/ext/js/background/offscreen-proxy.js +++ b/ext/js/background/offscreen-proxy.js @@ -143,7 +143,7 @@ export class TranslatorProxy { ...findTermsOptions, enabledDictionaryMap: enabledDictionaryMapList, excludeDictionaryDefinitions: excludeDictionaryDefinitionsList, - textReplacementsOptions: textReplacementsSerialized + textReplacements: textReplacementsSerialized }; return this._offscreen.sendMessagePromise({action: 'findTermsOffscreen', params: {mode, text, findTermsOptions: modifiedFindTermsOptions}}); } 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); } |