Трансляция Emoji из Unicode к общему виду
This commit is contained in:
@@ -119,6 +119,20 @@ export function TextParser(props: TextParserProps) {
|
|||||||
return <>{match}</>;
|
return <>{match}</>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// unicode emojis
|
||||||
|
pattern: [/\p{Emoji_Presentation}/u],
|
||||||
|
render: (match: string) => {
|
||||||
|
let textWithoutEmojis = props.text.replace(/\p{Emoji_Presentation}/gu, '');
|
||||||
|
if(textWithoutEmojis.length <= (props.oversizeIfTextSmallerThan ?? 0)) {
|
||||||
|
return <Emoji size={40} unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
||||||
|
}
|
||||||
|
return <Emoji unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
||||||
|
},
|
||||||
|
flush: (match: string) => {
|
||||||
|
return <Emoji unified={match.codePointAt(0)?.toString(16) || ''}></Emoji>;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// :emoji_code:
|
// :emoji_code:
|
||||||
pattern: [/:emoji_([a-zA-Z0-9_-]+):/],
|
pattern: [/:emoji_([a-zA-Z0-9_-]+):/],
|
||||||
|
|||||||
Reference in New Issue
Block a user