[WEB-5196] chore: switch from isomorphic-dompurify to dompurify (#7983)
* [WEB-5196] chore: switch from isomorphic-dompurify to dompurify Replace isomorphic-dompurify with dompurify package in utils. This change simplifies the dependency and uses the canonical DOMPurify package directly. * fix: removing dompurify from the space app as dependency * chore: remove unused import --------- Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
80bd1b6dcd
commit
e710f5b278
6 changed files with 100 additions and 621 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import DOMPurify from "dompurify";
|
||||
|
||||
export const addSpaceIfCamelCase = (str: string) => str.replace(/([a-z])([A-Z])/g, "$1 $2");
|
||||
|
||||
const fallbackCopyTextToClipboard = (text: string) => {
|
||||
|
|
@ -50,13 +48,6 @@ export const checkEmailValidity = (email: string): boolean => {
|
|||
return isEmailValid;
|
||||
};
|
||||
|
||||
export const isEmptyHtmlString = (htmlString: string, allowedHTMLTags: string[] = []) => {
|
||||
// Remove HTML tags using regex
|
||||
const cleanText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: allowedHTMLTags });
|
||||
// Trim the string and check if it's empty
|
||||
return cleanText.trim() === "";
|
||||
};
|
||||
|
||||
export const replaceUnderscoreIfSnakeCase = (str: string) => str.replace(/_/g, " ");
|
||||
|
||||
export const capitalizeFirstLetter = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue