[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:
Aaryan Khandelwal 2024-10-24 15:36:38 +05:30 committed by GitHub
parent 9fb353ef54
commit 14b31e3fcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 1592 additions and 1012 deletions

View 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;
};

View file

@ -0,0 +1,2 @@
export * from "./emoji.helper"
export * from "./string.helper"

View 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
};

View file

@ -1 +1,2 @@
export * from "./helpers";
export * from "./hooks";

View file

@ -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"
}
}