Merge pull request #378 from Nico-J/bugfix/remove-fancy-html

(Conditionally) remove HTML from event description
This commit is contained in:
Bailey Pumfleet authored and GitHub committed 2021-07-26 10:15:44 +01:00
commit ca5fac4203
3 files changed
+23 -3

No files matched your search

+7 -1
View File
@@ -25,5 +25,11 @@ export function getFormattedMeetingId(videoCallData: VideoCallData): string {
}
export function stripHtml(html: string): string {
return html.replace("<br />", "\n").replace(/<[^>]+>/g, "");
const aMailToRegExp = /<a[\s\w="_:#;]*href="mailto:([^<>"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g;
const aLinkRegExp = /<a[\s\w="_:#;]*href="([^<>"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g;
return html
.replace(/<br\s?\/>/g, "\n")
.replace(aMailToRegExp, "$1")
.replace(aLinkRegExp, "$2: $1")
.replace(/<[^>]+>/g, "");
}