Fix loading on older browsers (#397)
This commit is contained in:
parent
13248962af
commit
a2655ee6a5
3 changed files with 5 additions and 5 deletions
|
@ -88,7 +88,7 @@ function SpaceAddExistingContent({ roomId }) {
|
|||
};
|
||||
|
||||
const handleSearch = (ev) => {
|
||||
const term = ev.target.value.toLocaleLowerCase().replaceAll(' ', '');
|
||||
const term = ev.target.value.toLocaleLowerCase().replace(/\s/g, '');
|
||||
if (term === '') {
|
||||
setSearchIds(null);
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ function SpaceAddExistingContent({ roomId }) {
|
|||
if (!name) return false;
|
||||
name = name.normalize('NFKC')
|
||||
.toLocaleLowerCase()
|
||||
.replaceAll(' ', '');
|
||||
.replace(/\s/g, '');
|
||||
return name.includes(term);
|
||||
});
|
||||
setSearchIds(searchedIds);
|
||||
|
|
|
@ -97,13 +97,13 @@ function getFormattedBody(markdown) {
|
|||
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'] || {};
|
||||
|
|
|
@ -123,7 +123,7 @@ class AsyncSearch extends EventEmitter {
|
|||
_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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue