260803_01_ENH: kri editor에서 preview 노드 커스텀 가능하도록 수정
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -72,6 +72,7 @@ export type KriEditorProps = {
|
||||
renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode
|
||||
editorExtensions?: Extensions
|
||||
allowedCustomHtml?: KriEditorAllowedHtml
|
||||
transformPreviewHtml?: (html: string) => string
|
||||
}
|
||||
|
||||
export type ToolbarState = {
|
||||
|
||||
Reference in New Issue
Block a user