Fix loading on older browsers (#397)
authorNitan Alexandru Marcel <nitan.marcel@protonmail.com>
Fri, 18 Mar 2022 03:36:48 +0000 (03:36 +0000)
committerGitHub <noreply@github.com>
Fri, 18 Mar 2022 03:36:48 +0000 (09:06 +0530)
src/app/molecules/space-add-existing/SpaceAddExisting.jsx
src/client/state/RoomsInput.js
src/util/AsyncSearch.js

index f7a3120d62acda76d759b21f07602cbbfc80732d..a9de7bdb91e4fbd555966d803d6df091432426b5 100644 (file)
@@ -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);
index 3bb36887ff5a003ea5e63a907f1c26b7f679d95f..1e2fa1921f675855be24cd8bbe7e7cb40dc8a389 100644 (file)
@@ -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'] || {};
index eb39f29c970fc5d9979e86cb36113477c7df86e4..d0a2130ea336e29fa26112e5d62096efd5fd273c 100644 (file)
@@ -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;
   }