perf: http recognition and input textarea

This commit is contained in:
archer
2023-05-15 13:43:17 +08:00
parent 32a8d68c6c
commit e7d3a8e2e1
6 changed files with 238 additions and 24 deletions

View File

@@ -113,3 +113,9 @@ export const voiceBroadcast = ({ text }: { text: string }) => {
cancel: () => window.speechSynthesis?.cancel()
};
};
export const formatLinkTextToHtml = (text: string) => {
const httpReg =
/(?<!\[.*\]\()((http|https|ftp):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)(?![\)])/gi;
return text.replace(httpReg, '<a href="$&" target="_blank">$&</a>');
};