Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add graphemer for grapheme cluster counting

ElshadHu e88fdbf6 e2951aa2

+5 -2
+5 -2
js/components/src/components/chat/chat-box.tsx
··· 1 1 import Picker from "@emoji-mart/react"; 2 + import Graphemer from "graphemer"; 2 3 import { AtSignIcon, ExternalLink, X } from "lucide-react-native"; 3 4 import { env } from "process"; 4 5 import { useEffect, useMemo, useRef, useState } from "react"; ··· 41 42 ..."πŸ˜€πŸ₯ΈπŸ˜πŸ˜˜πŸ˜πŸ₯ΈπŸ˜†πŸ₯ΈπŸ˜œπŸ₯ΈπŸ˜‚πŸ˜…πŸ₯ΈπŸ™‚πŸ€«πŸ˜±πŸ₯ΈπŸ€£πŸ˜—πŸ˜„πŸ₯ΈπŸ˜ŽπŸ€“πŸ˜²πŸ˜―😰πŸ₯ΈπŸ˜₯πŸ₯ΈπŸ˜£πŸ₯ΈπŸ˜žπŸ˜“πŸ₯ΈπŸ˜©πŸ˜©πŸ₯ΈπŸ˜€πŸ₯±", 42 43 ]; 43 44 45 + const graphemer = new Graphemer(); 46 + 44 47 export function ChatBox({ 45 48 isPopout, 46 49 chatBoxStyle, ··· 65 68 new Map(), 66 69 ); 67 70 const [filteredEmojis, setFilteredEmojis] = useState<any[]>([]); 68 - const isOverLimit = [...message].length > 300; 71 + const isOverLimit = graphemer.countGraphemes(message) > 300; 69 72 70 73 let linfo = useLivestream(); 71 74 ··· 256 259 257 260 const submit = async () => { 258 261 if (!message.trim()) return; 259 - if ([...message].length > 300) { 262 + if (graphemer.countGraphemes(message) > 300) { 260 263 toast.show( 261 264 "Message too long", 262 265 "Please limit your message to 300 characters.",