feat: share unlogin.perf: link format and model ui

This commit is contained in:
archer
2023-05-19 10:26:30 +08:00
parent a62a9c4067
commit 246ee973ec
15 changed files with 283 additions and 394 deletions

View File

@@ -115,8 +115,12 @@ export const voiceBroadcast = ({ text }: { text: string }) => {
};
};
export const formatLinkTextToHtml = (text: string) => {
export const formatLinkText = (text: string) => {
const httpReg =
/(http|https|ftp):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/gi;
return text.replace(httpReg, '<a href="$&" target="_blank">$&</a>');
return text.replace(httpReg, ` $& `);
};
export const getErrText = (err: any, def = '') => {
return typeof err === 'string' ? err : err?.message || def;
};