From a2655ee6a551f911ff2ba180d2e2b889a7d469a6 Mon Sep 17 00:00:00 2001 From: Nitan Alexandru Marcel Date: Fri, 18 Mar 2022 03:36:48 +0000 Subject: [PATCH] Fix loading on older browsers (#397) --- src/app/molecules/space-add-existing/SpaceAddExisting.jsx | 4 ++-- src/client/state/RoomsInput.js | 4 ++-- src/util/AsyncSearch.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/molecules/space-add-existing/SpaceAddExisting.jsx b/src/app/molecules/space-add-existing/SpaceAddExisting.jsx index f7a3120..a9de7bd 100644 --- a/src/app/molecules/space-add-existing/SpaceAddExisting.jsx +++ b/src/app/molecules/space-add-existing/SpaceAddExisting.jsx @@ -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); diff --git a/src/client/state/RoomsInput.js b/src/client/state/RoomsInput.js index 3bb3688..1e2fa19 100644 --- a/src/client/state/RoomsInput.js +++ b/src/client/state/RoomsInput.js @@ -97,13 +97,13 @@ function getFormattedBody(markdown) { function getReplyFormattedBody(roomId, reply) { const replyToLink = `In reply to`; const userLink = `${reply.userId}`; - const formattedReply = getFormattedBody(reply.body.replaceAll('\n', '\n> ')); + const formattedReply = getFormattedBody(reply.body.replace(/\n/g, '\n> ')); return `
${replyToLink}${userLink}
${formattedReply}
`; } 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'] || {}; diff --git a/src/util/AsyncSearch.js b/src/util/AsyncSearch.js index eb39f29..d0a2130 100644 --- a/src/util/AsyncSearch.js +++ b/src/util/AsyncSearch.js @@ -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; }