Skip to content

Commit

Permalink
fix: issue with String.replaceAll being undefined function (#2271)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede authored Oct 20, 2023
1 parent 07c7ee5 commit af9050a
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 af9050a

Please sign in to comment.