mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
Add support for rendering emojis in stories and remove hashtags
Install twemoji-parser and node-fetch, create a new EmojiRenderer service for handling emoji rendering on canvas using Twemoji, and update the text processing logic to remove hashtags instead of emojis in shared/emoji.ts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: ff08c9a2-11f7-4c75-8c8f-f60e79069dce Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/C5fWcTz
This commit is contained in:
1 parent
3d26473967
commit
3936220a94
4 files changed
+345
-35
No files matched your search
+4
-10
@@ -1,16 +1,10 @@
|
||||
import emojiRegex from 'emoji-regex';
|
||||
|
||||
// Cached regex instance for performance
|
||||
const emojiPattern = emojiRegex();
|
||||
|
||||
/**
|
||||
* Removes emojis from text while preserving other Unicode characters
|
||||
* Uses the emoji-regex package which correctly identifies emojis without
|
||||
* removing legitimate astral-plane characters (CJK Extension B, etc.)
|
||||
* Removes hashtags from text while preserving emojis and other content
|
||||
* Matches patterns like #hashtag, #HashTag123, etc.
|
||||
*/
|
||||
export function removeEmojis(text: string): string {
|
||||
export function removeHashtags(text: string): string {
|
||||
return text
|
||||
.replace(emojiPattern, '')
|
||||
.replace(/#[\w\u00C0-\u017F]+/g, '') // Remove hashtags (supports accented characters)
|
||||
.replace(/\s+/g, ' ') // Normalize whitespace
|
||||
.trim();
|
||||
}
|
||||
Reference in new issue
Block a user