feat: advanced tab platform wrapper (#16941)
* fixed error in advanced tab atom build -- used `DOMPurify` instead of `sanitize-html` * hide BookerLayoutSelector for platform and removePlatformClientIdFromEmail * fixup! Merge branch 'main' into event-advanced-platform-wrapper * undo linting changes * undo linting changes * fix: active state of tabs items --------- Co-authored-by: Morgan <[email protected]> Co-authored-by: Morgan Vernay <[email protected]>
This commit is contained in:
17 files changed
+208
-101
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
import { md } from "@calcom/lib/markdownIt";
|
||||
|
||||
if (typeof window == "undefined") {
|
||||
console.warn(
|
||||
"`markdownToSafeHTMLClient` should not be used on the server side. use markdownToSafeHTML instead"
|
||||
);
|
||||
}
|
||||
|
||||
export function markdownToSafeHTMLClient(markdown: string | null) {
|
||||
if (!markdown) return "";
|
||||
|
||||
const html = md.render(markdown);
|
||||
|
||||
const safeHTML = DOMPurify.sanitize(html);
|
||||
|
||||
const safeHTMLWithListFormatting = safeHTML
|
||||
.replace(
|
||||
/<ul>/g,
|
||||
"<ul style='list-style-type: disc; list-style-position: inside; margin-left: 12px; margin-bottom: 4px'>"
|
||||
)
|
||||
.replace(
|
||||
/<ol>/g,
|
||||
"<ol style='list-style-type: decimal; list-style-position: inside; margin-left: 12px; margin-bottom: 4px'>"
|
||||
)
|
||||
.replace(/<a\s+href=/g, "<a target='_blank' class='text-blue-500 hover:text-blue-600' href=");
|
||||
|
||||
return safeHTMLWithListFormatting;
|
||||
}
|
||||
Reference in new issue
Block a user