diff --git a/package.json b/package.json index c041b54..30c6b95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kri-ui-registry", - "version": "0.9.6", + "version": "0.9.7", "private": true, "description": "KRI internal shadcn UI registry", "scripts": { diff --git a/registry/components/kri-editor/KriEditorWysiwyg.tsx b/registry/components/kri-editor/KriEditorWysiwyg.tsx index a576799..8522a75 100644 --- a/registry/components/kri-editor/KriEditorWysiwyg.tsx +++ b/registry/components/kri-editor/KriEditorWysiwyg.tsx @@ -89,6 +89,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) { toolbar = {}, editorExtensions = [], allowedCustomHtml, + transformPreviewHtml, } = props; const showHtmlToggle = mode === "both"; @@ -561,8 +562,9 @@ export function KriEditorWysiwyg(props: KriEditorProps) { }, [command, editor, props.onCommandReady]); const previewHtml = useMemo(() => { - return sanitizeHtmlOpt ? sanitizeHtml(previewSource, allowedCustomHtml) : previewSource; - }, [allowedCustomHtml, previewSource, sanitizeHtmlOpt]); + const sanitized = sanitizeHtmlOpt ? sanitizeHtml(previewSource, allowedCustomHtml) : previewSource; + return transformPreviewHtml ? transformPreviewHtml(sanitized) : sanitized; + }, [allowedCustomHtml, previewSource, sanitizeHtmlOpt, transformPreviewHtml]); if (!editor) { return ( diff --git a/registry/components/kri-editor/types.ts b/registry/components/kri-editor/types.ts index fd9f394..e531b21 100644 --- a/registry/components/kri-editor/types.ts +++ b/registry/components/kri-editor/types.ts @@ -72,6 +72,7 @@ export type KriEditorProps = { renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode editorExtensions?: Extensions allowedCustomHtml?: KriEditorAllowedHtml + transformPreviewHtml?: (html: string) => string } export type ToolbarState = {