mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 07:20:29 +03:00
Allow html in m.text
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
b3e27da26d
commit
7fdf165ff3
2 changed files with 19 additions and 6 deletions
|
|
@ -67,7 +67,7 @@ function sanitizeImgTag(tagName, attributes) {
|
|||
return { tagName, attribs };
|
||||
}
|
||||
|
||||
export default function sanitize(body) {
|
||||
export function sanitizeCustomHtml(body) {
|
||||
return sanitizeHtml(body, {
|
||||
allowedTags: [
|
||||
'font',
|
||||
|
|
@ -142,3 +142,12 @@ export default function sanitize(body) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function sanitizeText(body) {
|
||||
const tagsToReplace = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
};
|
||||
return body.replace(/[&<>]/g, (tag) => tagsToReplace[tag] || tag);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue