@topconsultnpm/sdkui-react 6.19.0-dev1.41 → 6.19.0-dev1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,6 +11,8 @@ export const sanitizeAndFormatComment = (raw = "") => {
|
|
|
11
11
|
if (!raw)
|
|
12
12
|
return "";
|
|
13
13
|
let cleanComment = raw
|
|
14
|
+
// Simplify dx-mention markup - replace with just @username
|
|
15
|
+
.replace(/<span class="dx-mention"[^>]*>\uFEFF?<span[^>]*><span>@<\/span>([^<]+)<\/span>\uFEFF?<\/span>/gi, '@$1')
|
|
14
16
|
// Replace </p> with '' only if followed by <ol> or <ul>
|
|
15
17
|
.replace(/<\/p>(?=\s*<(ol|ul)>)/gi, '')
|
|
16
18
|
// Replace all other </p> with '\r\n'
|
|
@@ -113,7 +113,7 @@ const TMBlogCommentForm = (props) => {
|
|
|
113
113
|
const blogPost = new BlogPost();
|
|
114
114
|
// Retrieve the comment from formData, or use an empty string if undefined
|
|
115
115
|
const comment = formData?.comment ?? "";
|
|
116
|
-
// Clean the comment
|
|
116
|
+
// Clean the comment using the sanitizeAndFormatComment function
|
|
117
117
|
const cleanComment = sanitizeAndFormatComment(comment);
|
|
118
118
|
// Assign the cleaned comment as the description for the blog post
|
|
119
119
|
blogPost.description = cleanComment ?? "";
|