260722_01_ENH: 버그 수정 및 개선 사항 수정
This commit is contained in:
@@ -193,7 +193,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
editorProps: {
|
||||
attributes: {
|
||||
class: cn(
|
||||
"min-h-[180px] px-3 py-2 focus:outline-none",
|
||||
"min-h-[180px] max-h-[420px] overflow-y-auto px-3 py-2 focus:outline-none",
|
||||
"[&_p]:my-2 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0",
|
||||
"[&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6",
|
||||
"[&_li]:my-1",
|
||||
@@ -408,7 +408,6 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
if(onImageUploadError){
|
||||
onImageUploadError(err);
|
||||
}else{
|
||||
toast.error("이미지 업로드에 실패했습니다.");
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
@@ -477,11 +476,14 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
if (viewRef.current === "html") return;
|
||||
if (value == null) return;
|
||||
|
||||
// 빈 문자열("")은 ProseMirror 스키마상 유효한 문서가 아니라 setContent가 조용히 실패해
|
||||
// 이전 템플릿 본문이 그대로 남는 문제가 있었음 -> 빈 값은 빈 문단으로 정규화해서 비교/설정.
|
||||
const normalizedValue = value || "<p></p>";
|
||||
const current = editor.getHTML();
|
||||
|
||||
if (value !== current && value !== optimisticHtmlRef.current) {
|
||||
if (normalizedValue !== current && normalizedValue !== optimisticHtmlRef.current) {
|
||||
// 이미지가 포함된 HTML 업데이트면, 아예 editor를 새로 생성
|
||||
editor.commands.setContent(value, {
|
||||
editor.commands.setContent(normalizedValue, {
|
||||
emitUpdate: false,
|
||||
parseOptions: {preserveWhitespace: "full"},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user