From 7041aaa62bc378d15c75c61887a38fcfafbfd567 Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:49:10 +1030 Subject: [PATCH] adjust code style --- src/app/organisms/emoji-board/EmojiBoard.jsx | 6 +++--- src/app/organisms/room/RoomViewCmdBar.jsx | 4 ++-- src/util/twemojify.jsx | 12 +++++------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/app/organisms/emoji-board/EmojiBoard.jsx b/src/app/organisms/emoji-board/EmojiBoard.jsx index 5310ef10..f5374def 100644 --- a/src/app/organisms/emoji-board/EmojiBoard.jsx +++ b/src/app/organisms/emoji-board/EmojiBoard.jsx @@ -30,7 +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'; +import { getTwemojiCDN } from '../../../util/twemojify'; const ROW_EMOJIS_COUNT = 7; @@ -38,7 +38,7 @@ const EmojiGroup = React.memo(({ name, groupEmojis }) => { function getEmojiBoard() { const emojiBoard = []; const totalEmojis = groupEmojis.length; - var cdn = GetTwemojiCDN() + 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) { @@ -252,7 +252,7 @@ function EmojiBoard({ onSelect, searchRef }) { $emojiContent.children[tabIndex].scrollIntoView(); } - var cdn = GetTwemojiCDN() + var cdn = getTwemojiCDN() return (
diff --git a/src/app/organisms/room/RoomViewCmdBar.jsx b/src/app/organisms/room/RoomViewCmdBar.jsx index e6696537..b39e4b13 100644 --- a/src/app/organisms/room/RoomViewCmdBar.jsx +++ b/src/app/organisms/room/RoomViewCmdBar.jsx @@ -5,7 +5,7 @@ import './RoomViewCmdBar.scss'; import parse from 'html-react-parser'; import twemoji from 'twemoji'; -import { GetTwemojiCDN, twemojify } from '../../../util/twemojify'; +import { getTwemojiCDN, twemojify } from '../../../util/twemojify'; import initMatrix from '../../../client/initMatrix'; import { getEmojiForCompletion } from '../emoji-board/custom-emoji'; @@ -60,7 +60,7 @@ function renderSuggestions({ prefix, option, suggestions }, fireCmd) { unicode: emoji.unicode, shortcodes: emoji.shortcodes?.toString(), }), - base: GetTwemojiCDN() + base: getTwemojiCDN() }, )); } diff --git a/src/util/twemojify.jsx b/src/util/twemojify.jsx index 73a79571..9c05e11f 100644 --- a/src/util/twemojify.jsx +++ b/src/util/twemojify.jsx @@ -8,12 +8,12 @@ import { sanitizeText } from './sanitize'; const Math = lazy(() => import('../app/atoms/math/Math')); -const CDN_LOCAL = "/public/twemoji/assets/" -const CDN_EXTERNAL = "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/"; +const CDN_LOCAL = '/public/twemoji/assets/' +const CDN_EXTERNAL = 'https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/'; var use_local = false; -export const GetTwemojiCDN = () => { +export const getTwemojiCDN = () => { if(window.__TAURI__ || use_local){ return CDN_LOCAL } @@ -22,8 +22,6 @@ export const GetTwemojiCDN = () => { } }; - - const mathOptions = { replace: (node) => { const maths = node.attribs?.['data-mx-maths']; @@ -60,9 +58,9 @@ export function twemojify(text, opts, linkify = false, sanitize = true, maths = } if(opts){ - opts.base = GetTwemojiCDN() + opts.base = getTwemojiCDN() } else { - opts = { base: GetTwemojiCDN() } + opts = { base: getTwemojiCDN() } } content = twemoji.parse(content, opts);