260728_04_ENH: 에디터에 커스텀 태그 인식하도록 수정
This commit is contained in:
@@ -87,6 +87,8 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
allowBase64 = false,
|
||||
sanitizeHtml: sanitizeHtmlOpt = true,
|
||||
toolbar = {},
|
||||
editorExtensions = [],
|
||||
allowedCustomHtml,
|
||||
} = props;
|
||||
|
||||
const showHtmlToggle = mode === "both";
|
||||
@@ -179,6 +181,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
},
|
||||
}),
|
||||
Placeholder.configure({ placeholder }),
|
||||
...editorExtensions,
|
||||
],
|
||||
|
||||
content: value || "<p></p>",
|
||||
@@ -436,12 +439,12 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
}
|
||||
|
||||
const raw = htmlDraftRef.current;
|
||||
const safe = sanitizeHtmlOpt ? sanitizeHtml(raw) : raw;
|
||||
const safe = sanitizeHtmlOpt ? sanitizeHtml(raw, allowedCustomHtml) : raw;
|
||||
|
||||
editor.commands.setContent(safe, { emitUpdate: false, parseOptions: { preserveWhitespace: "full" } });
|
||||
flushChange(editor.getHTML());
|
||||
setView("wysiwyg");
|
||||
}, [editor, flushChange, sanitizeHtmlOpt]);
|
||||
}, [allowedCustomHtml, editor, flushChange, sanitizeHtmlOpt]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editor) return;
|
||||
@@ -558,8 +561,8 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
}, [command, editor, props.onCommandReady]);
|
||||
|
||||
const previewHtml = useMemo(() => {
|
||||
return sanitizeHtmlOpt ? sanitizeHtml(previewSource) : previewSource;
|
||||
}, [previewSource, sanitizeHtmlOpt]);
|
||||
return sanitizeHtmlOpt ? sanitizeHtml(previewSource, allowedCustomHtml) : previewSource;
|
||||
}, [allowedCustomHtml, previewSource, sanitizeHtmlOpt]);
|
||||
|
||||
if (!editor) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user