260803_01_ENH: kri editor에서 preview 노드 커스텀 가능하도록 수정
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "kri-ui-registry",
|
"name": "kri-ui-registry",
|
||||||
"version": "0.9.6",
|
"version": "0.9.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "KRI internal shadcn UI registry",
|
"description": "KRI internal shadcn UI registry",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
|||||||
toolbar = {},
|
toolbar = {},
|
||||||
editorExtensions = [],
|
editorExtensions = [],
|
||||||
allowedCustomHtml,
|
allowedCustomHtml,
|
||||||
|
transformPreviewHtml,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const showHtmlToggle = mode === "both";
|
const showHtmlToggle = mode === "both";
|
||||||
@@ -561,8 +562,9 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
|||||||
}, [command, editor, props.onCommandReady]);
|
}, [command, editor, props.onCommandReady]);
|
||||||
|
|
||||||
const previewHtml = useMemo(() => {
|
const previewHtml = useMemo(() => {
|
||||||
return sanitizeHtmlOpt ? sanitizeHtml(previewSource, allowedCustomHtml) : previewSource;
|
const sanitized = sanitizeHtmlOpt ? sanitizeHtml(previewSource, allowedCustomHtml) : previewSource;
|
||||||
}, [allowedCustomHtml, previewSource, sanitizeHtmlOpt]);
|
return transformPreviewHtml ? transformPreviewHtml(sanitized) : sanitized;
|
||||||
|
}, [allowedCustomHtml, previewSource, sanitizeHtmlOpt, transformPreviewHtml]);
|
||||||
|
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export type KriEditorProps = {
|
|||||||
renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode
|
renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode
|
||||||
editorExtensions?: Extensions
|
editorExtensions?: Extensions
|
||||||
allowedCustomHtml?: KriEditorAllowedHtml
|
allowedCustomHtml?: KriEditorAllowedHtml
|
||||||
|
transformPreviewHtml?: (html: string) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ToolbarState = {
|
export type ToolbarState = {
|
||||||
|
|||||||
Reference in New Issue
Block a user