리피터 컨테이너 드롭 처리 로직 개선: ScreenDesigner 컴포넌트에서 리피터 컨테이너의 드롭 이벤트 처리 시, 지원하는 컴포넌트 타입을 "repeat-container"와 "v2-repeat-container"로 확장하였습니다. 또한, 불필요한 로그 출력을 제거하여 코드의 가독성을 향상시켰습니다.

This commit is contained in:
kjs
2026-01-19 15:52:59 +09:00
parent e785dbbe6e
commit d69d509893

View File

@@ -2229,11 +2229,11 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
if (repeatContainer) {
const containerId = repeatContainer.getAttribute("data-component-id");
if (containerId) {
console.log("리피터 컨테이너 내부 드롭 감지:", { containerId, component });
// 해당 리피터 컨테이너 찾기
const targetComponent = layout.components.find((c) => c.id === containerId);
if (targetComponent && (targetComponent as any).componentType === "repeat-container") {
const compType = (targetComponent as any)?.componentType;
// v2-repeat-container 또는 repeat-container 모두 지원
if (targetComponent && (compType === "repeat-container" || compType === "v2-repeat-container")) {
const currentConfig = (targetComponent as any).componentConfig || {};
const currentChildren = currentConfig.children || [];
@@ -2266,7 +2266,6 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
setLayout(newLayout);
saveToHistory(newLayout);
console.log("리피터 컨테이너에 컴포넌트 추가 완료:", newChild);
return; // 리피터 컨테이너 처리 완료
}
}
@@ -2617,10 +2616,9 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
if (repeatContainer && type === "column" && column) {
const containerId = repeatContainer.getAttribute("data-component-id");
if (containerId) {
console.log("리피터 컨테이너 내부에 컬럼 드롭:", { containerId, column });
const targetComponent = layout.components.find((c) => c.id === containerId);
if (targetComponent && (targetComponent as any).componentType === "repeat-container") {
const rcType = (targetComponent as any)?.componentType;
if (targetComponent && (rcType === "repeat-container" || rcType === "v2-repeat-container")) {
const currentConfig = (targetComponent as any).componentConfig || {};
const currentChildren = currentConfig.children || [];
@@ -2652,7 +2650,6 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
setLayout(newLayout);
saveToHistory(newLayout);
console.log("리피터 컨테이너에 컬럼 기반 컴포넌트 추가 완료:", newChild);
return;
}
}
@@ -4786,7 +4783,6 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
onDropCapture={(e) => {
// 캡처 단계에서 드롭 이벤트를 처리하여 자식 요소 드롭도 감지
e.preventDefault();
console.log("🎯 캔버스 드롭 이벤트 (캡처), target:", (e.target as HTMLElement).tagName, (e.target as HTMLElement).getAttribute("data-repeat-container"));
handleDrop(e);
}}
>