nicolium: we can use dompurify directly
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -93,7 +93,7 @@
|
||||
"intersection-observer": "^0.12.2",
|
||||
"intl-messageformat": "^11.1.2",
|
||||
"intl-pluralrules": "^2.0.1",
|
||||
"isomorphic-dompurify": "^3.0.0",
|
||||
"dompurify": "^3.3.2",
|
||||
"leaflet": "^1.9.4",
|
||||
"lexical": "^0.41.0",
|
||||
"line-awesome": "^1.3.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import clsx from 'clsx';
|
||||
import { sanitize } from 'isomorphic-dompurify';
|
||||
import DOMPurify from 'dompurify';
|
||||
import {
|
||||
type MediaAttachment,
|
||||
type PreviewCard as CardEntity,
|
||||
@ -71,7 +71,7 @@ interface IPreviewCardVideo {
|
||||
|
||||
const PreviewCardVideo: React.FC<IPreviewCardVideo> = React.memo(
|
||||
React.forwardRef<HTMLDivElement, IPreviewCardVideo>(({ card }, ref) => {
|
||||
const html = sanitize(handleIframeUrl(card.html, card.url, card.provider_name), {
|
||||
const html = DOMPurify.sanitize(handleIframeUrl(card.html, card.url, card.provider_name), {
|
||||
ADD_TAGS: ['iframe'],
|
||||
ADD_ATTR: ['allow', 'allowfullscreen', 'referrerpolicy'],
|
||||
});
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import DOMPurify from 'dompurify';
|
||||
import parse, {
|
||||
Element,
|
||||
type HTMLReactParserOptions,
|
||||
domToReact,
|
||||
type DOMNode,
|
||||
} from 'html-react-parser';
|
||||
import { sanitize } from 'isomorphic-dompurify';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import minBy from 'lodash/minBy';
|
||||
import React from 'react';
|
||||
@ -345,7 +345,7 @@ function parseContent(
|
||||
};
|
||||
|
||||
let content = parse(
|
||||
sanitize(html, { ADD_ATTR: ['target'], USE_PROFILES: { html: true } }),
|
||||
DOMPurify.sanitize(html, { ADD_ATTR: ['target'], USE_PROFILES: { html: true } }),
|
||||
options,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user