260803_01_ENH: kri editor에서 preview 노드 커스텀 가능하도록 수정

This commit is contained in:
2026-08-03 10:54:43 +09:00
parent cf6e9ec909
commit 2ecd4d7119
3 changed files with 6 additions and 3 deletions

View File

@@ -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": {

View File

@@ -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 (

View File

@@ -72,6 +72,7 @@ export type KriEditorProps = {
renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode
editorExtensions?: Extensions
allowedCustomHtml?: KriEditorAllowedHtml
transformPreviewHtml?: (html: string) => string
}
export type ToolbarState = {