};
const handleSearch = (ev) => {
- const term = ev.target.value.toLocaleLowerCase().replaceAll(' ', '');
+ const term = ev.target.value.toLocaleLowerCase().replace(/\s/g, '');
if (term === '') {
setSearchIds(null);
return;
if (!name) return false;
name = name.normalize('NFKC')
.toLocaleLowerCase()
- .replaceAll(' ', '');
+ .replace(/\s/g, '');
return name.includes(term);
});
setSearchIds(searchedIds);
function getReplyFormattedBody(roomId, reply) {
const replyToLink = `<a href="https://matrix.to/#/${roomId}/${reply.eventId}">In reply to</a>`;
const userLink = `<a href="https://matrix.to/#/${reply.userId}">${reply.userId}</a>`;
- const formattedReply = getFormattedBody(reply.body.replaceAll('\n', '\n> '));
+ const formattedReply = getFormattedBody(reply.body.replace(/\n/g, '\n> '));
return `<mx-reply><blockquote>${replyToLink}${userLink}<br />${formattedReply}</blockquote></mx-reply>`;
}
function bindReplyToContent(roomId, reply, content) {
const newContent = { ...content };
- newContent.body = `> <${reply.userId}> ${reply.body.replaceAll('\n', '\n> ')}`;
+ newContent.body = `> <${reply.userId}> ${reply.body.replace(/\n/g, '\n> ')}`;
newContent.body += `\n\n${content.body}`;
newContent.format = 'org.matrix.custom.html';
newContent['m.relates_to'] = content['m.relates_to'] || {};
_normalize(item) {
let myItem = item.normalize(this.normalizeUnicode ? 'NFKC' : 'NFC');
if (!this.isCaseSensitive) myItem = myItem.toLocaleLowerCase();
- if (this.ignoreWhitespace) myItem = myItem.replaceAll(' ', '');
+ if (this.ignoreWhitespace) myItem = myItem.replace(/\s/g, '');
return myItem;
}