260722_01_ENH: 버그 수정 및 개선 사항 수정
This commit is contained in:
@@ -117,7 +117,7 @@ export function KriEditorHtmlOnly({
|
||||
})
|
||||
} catch (error) {
|
||||
if (onImageUploadError) onImageUploadError(error)
|
||||
else toast.error('이미지 업로드에 실패했습니다.')
|
||||
else console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ export function KriEditorSms({
|
||||
|
||||
return (
|
||||
<div className={cn('mx-auto w-full max-w-[320px]', className)}>
|
||||
{label ? <div className="mb-2 text-sm font-semibold">{label}</div> : null}
|
||||
<div className="relative h-[600px] w-full overflow-hidden rounded-[40px] border-8 border-gray-800 bg-white shadow-2xl">
|
||||
<div className="absolute top-0 left-1/2 z-10 h-6 w-32 -translate-x-1/2 rounded-b-2xl bg-gray-800" />
|
||||
<div className="flex h-full flex-col bg-gray-50 px-4 pt-8 pb-4">
|
||||
@@ -106,6 +105,7 @@ export function KriEditorSms({
|
||||
{...textareaInsert.bindSelectionHandlers}
|
||||
/>
|
||||
</div>
|
||||
{label ? <div className="my-2 text-sm font-semibold text-red-600">{label}</div> : null}
|
||||
{byteSize > maxBytes ? (
|
||||
<p className="mt-2 px-2 text-center text-xs font-medium text-red-600">
|
||||
최대 용량을 {byteSize - maxBytes}byte 초과했습니다.
|
||||
|
||||
@@ -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