다중 선택 컴포넌트 동시 이동 및 잠금 컴포넌트 복사 제한
This commit is contained in:
parent
a299195b42
commit
386ce629ac
|
|
@ -285,7 +285,18 @@ export function ReportDesignerProvider({ reportId, children }: { reportId: strin
|
|||
// 복사 (Ctrl+C)
|
||||
const copyComponents = useCallback(() => {
|
||||
if (selectedComponentIds.length > 0) {
|
||||
const componentsToCopy = components.filter((comp) => selectedComponentIds.includes(comp.id));
|
||||
// 잠긴 컴포넌트는 복사에서 제외
|
||||
const componentsToCopy = components.filter(
|
||||
(comp) => selectedComponentIds.includes(comp.id) && !comp.locked
|
||||
);
|
||||
if (componentsToCopy.length === 0) {
|
||||
toast({
|
||||
title: "복사 불가",
|
||||
description: "잠긴 컴포넌트는 복사할 수 없습니다.",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
setClipboard(componentsToCopy);
|
||||
toast({
|
||||
title: "복사 완료",
|
||||
|
|
@ -294,6 +305,15 @@ export function ReportDesignerProvider({ reportId, children }: { reportId: strin
|
|||
} else if (selectedComponentId) {
|
||||
const componentToCopy = components.find((comp) => comp.id === selectedComponentId);
|
||||
if (componentToCopy) {
|
||||
// 잠긴 컴포넌트는 복사 불가
|
||||
if (componentToCopy.locked) {
|
||||
toast({
|
||||
title: "복사 불가",
|
||||
description: "잠긴 컴포넌트는 복사할 수 없습니다.",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
setClipboard([componentToCopy]);
|
||||
toast({
|
||||
title: "복사 완료",
|
||||
|
|
|
|||
Loading…
Reference in New Issue