nicolium: we can use dompurify directly

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-06 16:07:18 +01:00
parent 0e24dcdc41
commit 02ae4b7706
4 changed files with 12 additions and 24 deletions

View File

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

View File

@ -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'],
});

View File

@ -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,
);