diff --git a/apps/client/src/widgets/dialogs/revisions.tsx b/apps/client/src/widgets/dialogs/revisions.tsx index 66ce763a3d..1772f60f1a 100644 --- a/apps/client/src/widgets/dialogs/revisions.tsx +++ b/apps/client/src/widgets/dialogs/revisions.tsx @@ -14,6 +14,7 @@ import { t } from "../../services/i18n"; import { renderMathInElement } from "../../services/math"; import open from "../../services/open"; import options from "../../services/options"; +import { sanitizeNoteContentHtml } from "../../services/sanitize_content.js"; import protected_session_holder from "../../services/protected_session_holder"; import server from "../../services/server"; import toast from "../../services/toast"; @@ -291,7 +292,7 @@ function RevisionContentText({ content }: { content: string | Buffer; + return ; } function RevisionContentDiff({ noteContent, itemContent, itemType }: { diff --git a/apps/client/src/widgets/react/RawHtml.tsx b/apps/client/src/widgets/react/RawHtml.tsx index 25a37ea93f..502fc56f5d 100644 --- a/apps/client/src/widgets/react/RawHtml.tsx +++ b/apps/client/src/widgets/react/RawHtml.tsx @@ -1,8 +1,6 @@ import DOMPurify from "dompurify"; import type { CSSProperties, HTMLProps, RefObject } from "preact/compat"; -import { sanitizeNoteContentHtml } from "../../services/sanitize_content.js"; - type HTMLElementLike = string | HTMLElement | JQuery; interface RawHtmlProps extends Pick, "tabindex" | "dir"> { @@ -39,7 +37,7 @@ export function getHtml(html: string | HTMLElement | JQuery) { } return { - __html: sanitizeNoteContentHtml(html as string) + __html: html as string }; } diff --git a/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx b/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx index 3352f621a0..b6f4267b09 100644 --- a/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx +++ b/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx @@ -13,6 +13,7 @@ import { applyInlineMermaid, rewriteMermaidDiagramsInContainer } from "../../../ import { getLocaleById } from "../../../services/i18n"; import { renderMathInElement } from "../../../services/math"; import { formatCodeBlocks } from "../../../services/syntax_highlight"; +import { sanitizeNoteContentHtml } from "../../../services/sanitize_content.js"; import { useNoteBlob, useNoteLabel, useTriliumEvent, useTriliumOptionBool } from "../../react/hooks"; import { RawHtmlBlock } from "../../react/RawHtml"; import TouchBar, { TouchBarButton, TouchBarSpacer } from "../../react/TouchBar"; @@ -61,7 +62,7 @@ export default function ReadOnlyText({ note, noteContext, ntxId }: TypeWidgetPro className={clsx("note-detail-readonly-text-content ck-content use-tn-links selectable-text", codeBlockWordWrap && "word-wrap")} tabindex={100} dir={isRtl ? "rtl" : "ltr"} - html={blob?.content} + html={blob?.content ? sanitizeNoteContentHtml(blob.content as string) : undefined} />