mirror of
https://github.com/array-in-a-matrix/xinny.git
synced 2024-05-16 19:30:16 -04:00
remove twemoji
This commit is contained in:
parent
7a0fe843dc
commit
23580c9de7
|
@ -210,19 +210,13 @@ const MessageBody = React.memo(({
|
||||||
let content = null;
|
let content = null;
|
||||||
if (isCustomHTML) {
|
if (isCustomHTML) {
|
||||||
try {
|
try {
|
||||||
content = twemojify(
|
content = twemojify(sanitizeCustomHtml(initMatrix.matrixClient, body), undefined, true, false);
|
||||||
sanitizeCustomHtml(initMatrix.matrixClient, body),
|
|
||||||
undefined,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
} catch {
|
} catch {
|
||||||
console.error('Malformed custom html: ', body);
|
console.error('Malformed custom html: ', body);
|
||||||
content = twemojify(body, undefined);
|
content = twemojify(body);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content = twemojify(body, undefined, true);
|
content = twemojify(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if this message should render with large emojis
|
// Determine if this message should render with large emojis
|
||||||
|
|
|
@ -161,7 +161,7 @@ function RoomProfile({ roomId }) {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Text variant="b3">{room.getCanonicalAlias() || room.roomId}</Text>
|
<Text variant="b3">{room.getCanonicalAlias() || room.roomId}</Text>
|
||||||
{roomTopic && <Text variant="b2">{twemojify(roomTopic, undefined, true)}</Text>}
|
{roomTopic && <Text variant="b2">{twemojify(roomTopic)}</Text>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ function RoomTile({
|
||||||
</Text>
|
</Text>
|
||||||
{
|
{
|
||||||
desc !== null && (typeof desc === 'string')
|
desc !== null && (typeof desc === 'string')
|
||||||
? <Text className="room-tile__content__desc" variant="b2">{twemojify(desc, undefined, true)}</Text>
|
? <Text className="room-tile__content__desc" variant="b2">{twemojify(desc)}</Text>
|
||||||
: desc
|
: desc
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -338,7 +338,7 @@ function EmojiBoard({ onSelect, searchRef }) {
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</div>
|
</div>
|
||||||
<div ref={emojiInfo} className="emoji-board__content__info">
|
<div ref={emojiInfo} className="emoji-board__content__info">
|
||||||
<div>{parse(twemoji.parse('🙂', { base: TWEMOJI_BASE_URL }))}</div>
|
<div>{parse('🙂')}</div>
|
||||||
<Text>:slight_smile:</Text>
|
<Text>:slight_smile:</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import './RoomViewCmdBar.scss';
|
||||||
import parse from 'html-react-parser';
|
import parse from 'html-react-parser';
|
||||||
import twemoji from 'twemoji';
|
import twemoji from 'twemoji';
|
||||||
|
|
||||||
import { twemojify, TWEMOJI_BASE_URL } from '../../../util/twemojify';
|
import { twemojify } from '../../../util/twemojify';
|
||||||
|
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import { getEmojiForCompletion } from '../emoji-board/custom-emoji';
|
import { getEmojiForCompletion } from '../emoji-board/custom-emoji';
|
||||||
|
@ -53,15 +53,7 @@ function renderSuggestions({ prefix, option, suggestions }, fireCmd) {
|
||||||
|
|
||||||
// Renders a small Twemoji
|
// Renders a small Twemoji
|
||||||
function renderTwemoji(emoji) {
|
function renderTwemoji(emoji) {
|
||||||
return parse(
|
return parse(emoji.unicode);
|
||||||
twemoji.parse(emoji.unicode, {
|
|
||||||
attributes: () => ({
|
|
||||||
unicode: emoji.unicode,
|
|
||||||
shortcodes: emoji.shortcodes?.toString(),
|
|
||||||
}),
|
|
||||||
base: TWEMOJI_BASE_URL,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render a custom emoji
|
// Render a custom emoji
|
||||||
|
|
|
@ -62,7 +62,7 @@ function RoomIntroContainer({ event, timeline }) {
|
||||||
avatarSrc = isDM ? room.getAvatarFallbackMember()?.getAvatarUrl(mx.baseUrl, 80, 80, 'crop') : avatarSrc;
|
avatarSrc = isDM ? room.getAvatarFallbackMember()?.getAvatarUrl(mx.baseUrl, 80, 80, 'crop') : avatarSrc;
|
||||||
|
|
||||||
const heading = isDM ? room.name : `Welcome to ${room.name}`;
|
const heading = isDM ? room.name : `Welcome to ${room.name}`;
|
||||||
const topic = twemojify(roomTopic || '', undefined, true);
|
const topic = twemojify(roomTopic || '');
|
||||||
const nameJsx = twemojify(room.name);
|
const nameJsx = twemojify(room.name);
|
||||||
const desc = isDM
|
const desc = isDM
|
||||||
? (
|
? (
|
||||||
|
|
|
@ -151,7 +151,7 @@ function SpaceManageItem({
|
||||||
: <Button variant="primary" onClick={handleJoin} disabled={isJoining}>{isJoining ? 'Joining...' : 'Join'}</Button>
|
: <Button variant="primary" onClick={handleJoin} disabled={isJoining}>{isJoining ? 'Joining...' : 'Join'}</Button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
{isExpand && roomInfo.topic && <Text variant="b2">{twemojify(roomInfo.topic, undefined, true)}</Text>}
|
{isExpand && roomInfo.topic && <Text variant="b2">{twemojify(roomInfo.topic)}</Text>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,20 +30,16 @@ const mathOptions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} text - text to twemojify
|
* @param {string} text - text
|
||||||
* @param {object|undefined} opts - options for tweomoji.parse
|
* @param {undefined} opts
|
||||||
* @param {boolean} [linkify=false] - convert links to html tags (default: false)
|
* @param {boolean} [linkify=true] - convert links to html tags (default: true)
|
||||||
* @param {boolean} [sanitize=true] - sanitize html text (default: true)
|
* @param {boolean} [sanitize=true] - sanitize html text (default: true)
|
||||||
* @param {boolean} [maths=false] - render maths (default: false)
|
* @param {boolean} [maths=true] - render maths (default: true)
|
||||||
* @returns React component
|
* @returns React component
|
||||||
*/
|
*/
|
||||||
export function twemojify(text, opts, linkify = false, sanitize = true, maths = true) {
|
export function twemojify(text, opts, linkify = true, sanitize = true, maths = true) {
|
||||||
if (typeof text !== 'string') return text;
|
if (typeof text !== 'string') return text;
|
||||||
let content = text;
|
let content = text;
|
||||||
const options = opts ?? { base: TWEMOJI_BASE_URL };
|
|
||||||
if (!options.base) {
|
|
||||||
options.base = TWEMOJI_BASE_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sanitize) {
|
if (sanitize) {
|
||||||
content = sanitizeText(content);
|
content = sanitizeText(content);
|
||||||
|
|
Loading…
Reference in a new issue