mirror of
https://github.com/cinnyapp/cinny.git
synced 2026-11-20 00:51:24 -08:00
fix: emojis showing title instead of popup shortcode (#2732)
* Emojis now show popup shortcode * Custom emojis also show popup shortcode
This commit is contained in:
1 parent
3c22445f87
commit
21829bbe5e
1 file changed
+54
-17
@@ -207,13 +207,28 @@ export const scaleSystemEmoji = (text: string): (string | JSX.Element)[] =>
|
||||
findAndReplace(
|
||||
text,
|
||||
EMOJI_REG_G,
|
||||
(match, pushIndex) => (
|
||||
<span key={`scaleSystemEmoji-${pushIndex}`} className={css.EmoticonBase}>
|
||||
<span className={css.Emoticon()} title={getShortcodeFor(getHexcodeForEmoji(match[0]))}>
|
||||
{match[0]}
|
||||
</span>
|
||||
</span>
|
||||
),
|
||||
(match, pushIndex) => {
|
||||
const shortcode = getShortcodeFor(getHexcodeForEmoji(match[0])) ?? 'unknown';
|
||||
return (
|
||||
<TooltipProvider
|
||||
key={`scaleSystemEmoji-${pushIndex}`}
|
||||
position="Top"
|
||||
tooltip={
|
||||
<Tooltip style={{ maxWidth: toRem(200) }}>
|
||||
<Text size="T300">:{shortcode}:</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(targetRef) => (
|
||||
<span className={css.EmoticonBase}>
|
||||
<span ref={targetRef} className={css.Emoticon()}>
|
||||
{match[0]}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
);
|
||||
},
|
||||
(txt) => txt
|
||||
);
|
||||
|
||||
@@ -553,11 +568,22 @@ export const getReactCustomHtmlParser = (
|
||||
const htmlSrc = mxcToHttp(ct.session.baseUrl, props.src, params.useAuthentication).url();
|
||||
if (htmlSrc && 'data-mx-emoticon' in props) {
|
||||
return (
|
||||
<span className={css.EmoticonBase}>
|
||||
<span className={css.Emoticon()}>
|
||||
<img {...props} className={css.EmoticonImg} src={htmlSrc} />
|
||||
</span>
|
||||
</span>
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
tooltip={
|
||||
<Tooltip style={{ maxWidth: toRem(200) }}>
|
||||
<Text size="T300">:{props.title || props.alt || 'unknown'}:</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(targetRef) => (
|
||||
<span className={css.EmoticonBase}>
|
||||
<span ref={targetRef} className={css.Emoticon()}>
|
||||
<img {...props} title={undefined} className={css.EmoticonImg} src={htmlSrc} />
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
if (htmlSrc) return <img {...props} className={css.Img} src={htmlSrc} />;
|
||||
@@ -703,11 +729,22 @@ export const getReactCustomHtmlInlineParser = (
|
||||
const htmlSrc = mxcToHttp(ct.session.baseUrl, props.src, params.useAuthentication).url();
|
||||
if (htmlSrc && 'data-mx-emoticon' in props) {
|
||||
return (
|
||||
<span className={css.EmoticonBase}>
|
||||
<span className={css.Emoticon()}>
|
||||
<img {...props} className={css.EmoticonImg} src={htmlSrc} />
|
||||
</span>
|
||||
</span>
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
tooltip={
|
||||
<Tooltip style={{ maxWidth: toRem(200) }}>
|
||||
<Text size="T300">:{props.title || props.alt || 'unknown'}:</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(targetRef) => (
|
||||
<span className={css.EmoticonBase}>
|
||||
<span ref={targetRef} className={css.Emoticon()}>
|
||||
<img {...props} title={undefined} className={css.EmoticonImg} src={htmlSrc} />
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
if (htmlSrc) return <em>Click to see image</em>;
|
||||
|
||||
Reference in new issue
Block a user