From 7ed9567b8fcd27b1b3171397b617db645ce4bc47 Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Wed, 11 Jan 2023 10:28:14 +1030 Subject: [PATCH] Fix twemoji cdn + local storage --- .gitmodules | 3 +++ public/res/twemoji | 1 + src/app/organisms/emoji-board/EmojiBoard.jsx | 8 +++++-- src/app/organisms/room/RoomViewCmdBar.jsx | 3 ++- src/util/twemojify.jsx | 22 ++++++++++++++++++++ 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 public/res/twemoji diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..b6c6947f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "public/res/twemoji"] + path = public/res/twemoji + url = https://github.com/twitter/twemoji.git diff --git a/public/res/twemoji b/public/res/twemoji new file mode 160000 index 00000000..d94f4cf7 --- /dev/null +++ b/public/res/twemoji @@ -0,0 +1 @@ +Subproject commit d94f4cf793e6d5ca592aa00f58a88f6a4229ad43 diff --git a/src/app/organisms/emoji-board/EmojiBoard.jsx b/src/app/organisms/emoji-board/EmojiBoard.jsx index d9762323..5310ef10 100644 --- a/src/app/organisms/emoji-board/EmojiBoard.jsx +++ b/src/app/organisms/emoji-board/EmojiBoard.jsx @@ -30,6 +30,7 @@ import PhotoIC from '../../../../public/res/ic/outlined/photo.svg'; import BulbIC from '../../../../public/res/ic/outlined/bulb.svg'; import PeaceIC from '../../../../public/res/ic/outlined/peace.svg'; import FlagIC from '../../../../public/res/ic/outlined/flag.svg'; +import { GetTwemojiCDN } from '../../../util/twemojify'; const ROW_EMOJIS_COUNT = 7; @@ -37,7 +38,7 @@ const EmojiGroup = React.memo(({ name, groupEmojis }) => { function getEmojiBoard() { const emojiBoard = []; const totalEmojis = groupEmojis.length; - + var cdn = GetTwemojiCDN() for (let r = 0; r < totalEmojis; r += ROW_EMOJIS_COUNT) { const emojiRow = []; for (let c = r; c < r + ROW_EMOJIS_COUNT; c += 1) { @@ -58,6 +59,7 @@ const EmojiGroup = React.memo(({ name, groupEmojis }) => { hexcode: emoji.hexcode, loading: 'lazy', }), + base: cdn, }, )) // This is a custom emoji, and should be render as an mxc @@ -250,6 +252,8 @@ function EmojiBoard({ onSelect, searchRef }) { $emojiContent.children[tabIndex].scrollIntoView(); } + var cdn = GetTwemojiCDN() + return (