[PULSE-36] feat: callout component for pages and issue descriptions (#5856)
* feat: editor callouts * chore: backspace action updated * chore: update callout attributes types * chore: revert emoji picker changes * chore: removed class atrribute * chore: added sanitization for local storage values * chore: disable emoji picker search
This commit is contained in:
parent
9fb353ef54
commit
14b31e3fcd
37 changed files with 1592 additions and 1012 deletions
22
packages/helpers/helpers/emoji.helper.ts
Normal file
22
packages/helpers/helpers/emoji.helper.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export const convertHexEmojiToDecimal = (emojiUnified: string): string => {
|
||||
if (!emojiUnified) return "";
|
||||
|
||||
return emojiUnified
|
||||
.toString()
|
||||
.split("-")
|
||||
.map((e) => parseInt(e, 16))
|
||||
.join("-");
|
||||
};
|
||||
|
||||
export const emojiCodeToUnicode = (emoji: string) => {
|
||||
if (!emoji) return "";
|
||||
|
||||
// convert emoji code to unicode
|
||||
const uniCodeEmoji = emoji
|
||||
.toString()
|
||||
.split("-")
|
||||
.map((emoji) => parseInt(emoji, 10).toString(16))
|
||||
.join("-");
|
||||
|
||||
return uniCodeEmoji;
|
||||
};
|
||||
2
packages/helpers/helpers/index.ts
Normal file
2
packages/helpers/helpers/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./emoji.helper"
|
||||
export * from "./string.helper"
|
||||
15
packages/helpers/helpers/string.helper.ts
Normal file
15
packages/helpers/helpers/string.helper.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import DOMPurify from "isomorphic-dompurify";
|
||||
|
||||
/**
|
||||
* @description: This function will remove all the HTML tags from the string
|
||||
* @param {string} html
|
||||
* @return {string}
|
||||
* @example:
|
||||
* const html = "<p>Some text</p>";
|
||||
* const text = stripHTML(html);
|
||||
* console.log(text); // Some text
|
||||
*/
|
||||
export const sanitizeHTML = (htmlString: string) => {
|
||||
const sanitizedText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: [] }); // sanitize the string to remove all HTML tags
|
||||
return sanitizedText.trim(); // trim the string to remove leading and trailing whitespaces
|
||||
};
|
||||
|
|
@ -1 +1,2 @@
|
|||
export * from "./helpers";
|
||||
export * from "./hooks";
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@
|
|||
"devDependencies": {
|
||||
"@types/node": "^22.5.4",
|
||||
"@types/react": "^18.3.11",
|
||||
"typescript": "^5.3.3",
|
||||
"tsup": "^7.2.0"
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"isomorphic-dompurify": "^2.16.0",
|
||||
"react": "^18.3.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue