Skip to content

Commit

Permalink
fix: issue with String.replaceAll being undefined function
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Oct 19, 2023
1 parent 07c7ee5 commit 6951f9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ const getMentionUsers = <
}, '');

// escape special characters
return mentionUserString.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');
return mentionUserString.replace(/[.*+?^${}()|[\]\\]/g, function (match) {
return '\\' + match;
});
}

return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ export const renderText = <
if (userName) {
acc += `${acc.length ? '|' : ''}@${userName}`;
}
return acc.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');

return acc.replace(/[.*+?^${}()|[\]\\]/g, function (match) {
return '\\' + match;
});
}, '')
: '';

Expand Down

0 comments on commit 6951f9d

Please sign in to comment.