260805_01_ENH: 이메일 템플릿 저장 시 빈 칸 유지, 외부 설문에서 리스트 단건 조회, 리스트 헤더조회, 리스트 단건 수정 기능 사용할수 있도록 api 라우트 생성 및 cors 완화
This commit is contained in:
@@ -26,6 +26,7 @@ import { FontSize } from "./extensions/font-size";
|
||||
import { Div } from "./extensions/div";
|
||||
import { compressImage } from "./utils/imageCompression";
|
||||
import { sanitizeHtml } from "./utils/sanitizeHtml";
|
||||
import { preserveEmptyParagraphs } from "./utils/emptyParagraph";
|
||||
import { applyLinkPreviewClass, KRI_EDITOR_LINK_CLASS } from "./utils/linkPreview";
|
||||
import { Toolbar } from "./toolbar/Toolbar";
|
||||
import { useDebouncedChange } from "./hooks/useDebouncedChange";
|
||||
@@ -192,7 +193,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
if (viewRef.current === "html") return;
|
||||
const nextHtml = editor.getHTML();
|
||||
setPreviewSource(nextHtml);
|
||||
scheduleChange(nextHtml);
|
||||
scheduleChange(preserveEmptyParagraphs(nextHtml));
|
||||
},
|
||||
|
||||
editorProps: {
|
||||
@@ -444,7 +445,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
const safe = sanitizeHtmlOpt ? sanitizeHtml(raw, allowedCustomHtml) : raw;
|
||||
|
||||
editor.commands.setContent(safe, { emitUpdate: false, parseOptions: { preserveWhitespace: "full" } });
|
||||
flushChange(editor.getHTML());
|
||||
flushChange(preserveEmptyParagraphs(editor.getHTML()));
|
||||
setView("wysiwyg");
|
||||
}, [allowedCustomHtml, editor, flushChange, sanitizeHtmlOpt]);
|
||||
|
||||
@@ -506,8 +507,8 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
if (!editor) return;
|
||||
|
||||
const onBlur = () => {
|
||||
if (viewRef.current === "html") flushChange(htmlDraftRef.current);
|
||||
else flushChange(editor.getHTML());
|
||||
if (viewRef.current === "html") flushChange(preserveEmptyParagraphs(htmlDraftRef.current));
|
||||
else flushChange(preserveEmptyParagraphs(editor.getHTML()));
|
||||
};
|
||||
|
||||
editor.on("blur", onBlur);
|
||||
@@ -542,7 +543,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
if (!editor) return;
|
||||
restoreSelection();
|
||||
editor.chain().focus().insertContent(text).run();
|
||||
flushChange(editor.getHTML());
|
||||
flushChange(preserveEmptyParagraphs(editor.getHTML()));
|
||||
},
|
||||
}),
|
||||
[editor, restoreSelection, flushChange, insertTextareaText]
|
||||
@@ -563,7 +564,8 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
}, [command, editor, props.onCommandReady]);
|
||||
|
||||
const previewHtml = useMemo(() => {
|
||||
const sanitized = sanitizeHtmlOpt ? sanitizeHtml(previewSource, allowedCustomHtml) : previewSource;
|
||||
const preserved = preserveEmptyParagraphs(previewSource);
|
||||
const sanitized = sanitizeHtmlOpt ? sanitizeHtml(preserved, allowedCustomHtml) : preserved;
|
||||
const withLinkStyle = applyLinkPreviewClass(sanitized);
|
||||
return transformPreviewHtml ? transformPreviewHtml(withLinkStyle) : withLinkStyle;
|
||||
}, [allowedCustomHtml, previewSource, sanitizeHtmlOpt, transformPreviewHtml]);
|
||||
|
||||
Reference in New Issue
Block a user