Browse Source

fix: error when there's no regex match

Ahmad Kholid 3 years ago
parent
commit
5c5b38de8d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/content/blocks-handler/handler-get-text.js

+ 1 - 1
src/content/blocks-handler/handler-get-text.js

@@ -21,7 +21,7 @@ function getText(block) {
       onSelected(element) {
         let text = includeTags ? element.outerHTML : element.innerText;
 
-        if (regex) text = text.match(regex).join(' ');
+        if (regex) text = text.match(regex)?.join(' ') ?? text;
 
         text = (prefixText || '') + text + (suffixText || '');