{
+ const { shortcode, staticUrl, url } = shortcodeObj;
+ const regex = new RegExp(`:${shortcode}:`, 'g');
+ let match;
+
+ while ((match = regex.exec(text))) {
+ const beforeText = text.substring(lastIndex, match.index);
+ if (beforeText) {
+ components.push(beforeText);
+ }
+ components.push(
+ ,
+ );
+ lastIndex = match.index + match[0].length;
+ }
+ });
+
+ const afterText = text.substring(lastIndex);
+ if (afterText) {
+ components.push(afterText);
+ }
+
+ return components;
+}
+
+export default EmojiText;
diff --git a/src/components/name-text.jsx b/src/components/name-text.jsx
index f2e79ece..f994518d 100644
--- a/src/components/name-text.jsx
+++ b/src/components/name-text.jsx
@@ -1,9 +1,9 @@
import './name-text.css';
-import emojifyText from '../utils/emojify-text';
import states from '../utils/states';
import Avatar from './avatar';
+import EmojiText from './emoji-text';
function NameText({
account,
@@ -18,8 +18,6 @@ function NameText({
account;
let { username } = account;
- const displayNameWithEmoji = emojifyText(displayName, emojis);
-
const trimmedUsername = username.toLowerCase().trim();
const trimmedDisplayName = (displayName || '').toLowerCase().trim();
const shortenedDisplayName = trimmedDisplayName
@@ -58,11 +56,9 @@ function NameText({
)}
{displayName && !short ? (
<>
-
+
+
+