refactor(MessageRecord): 移除未使用的JSON解析函数

该函数未被组件使用,清理冗余代码以保持代码整洁
This commit is contained in:
超级老白兔
2025-09-18 10:17:14 +08:00
parent 7935936da1
commit 065b516bd7

View File

@@ -36,26 +36,6 @@ const MessageRecord: React.FC<MessageRecordProps> = ({ contract }) => {
);
};
// 提取content字符串中冒号后面的JSON部分
const extractJsonFromContent = (content: string): object | null => {
try {
// 查找第一个冒号的位置
const colonIndex = content.indexOf(":");
if (colonIndex === -1) {
return null;
}
// 提取冒号后面的部分并去除前后空格
const jsonStr = content.substring(colonIndex + 1).trim();
// 尝试解析JSON
return JSON.parse(jsonStr);
} catch (error) {
console.error("解析JSON失败:", error);
return null;
}
};
// 解析表情包文字格式[表情名称]并替换为img标签
const parseEmojiText = (text: string): React.ReactNode[] => {
const emojiRegex = /\[([^\]]+)\]/g;