diff --git a/src/message.tsx b/src/message.tsx index 483e33d..f163b74 100644 --- a/src/message.tsx +++ b/src/message.tsx @@ -12,35 +12,97 @@ interface EditMessageProps { setChatStore: (cs: ChatStore) => void; } +export const isVailedJSON = (str: string): boolean => { + try { + JSON.parse(str); + } catch (e) { + return false; + } + return true; +}; + function EditMessage(props: EditMessageProps) { const { setShowEdit, chat, setChatStore, chatStore } = props; return (