fix duplicate not working

This commit is contained in:
Nakul Nagargade 2025-03-21 01:59:57 +05:30
parent f11bea9e3d
commit 31a55a57bb

View file

@ -41,7 +41,7 @@ export const addNewWidgetToTheEditor = (componentType, eventMonitorObject, curre
// Adjust widget width based on the dropping canvas width
const mainCanvasWidth = useGridStore.getState().subContainerWidths['canvas'];
let width = Math.round((defaultWidth * mainCanvasWidth) / gridWidth);
console.log(width, gridWidth, 'width');
// Ensure minimum width
width = Math.max(width, 1);
@ -518,6 +518,7 @@ export function pasteComponents(targetParentId, copiedComponentObj) {
}
pastedComponents.forEach((component) => {
component = deepClone(component);
const newComponentId = isCut ? component.id : uuidv4();
const componentName = computeComponentName(component.component.component, {
...components,
@ -575,7 +576,11 @@ export function pasteComponents(targetParentId, copiedComponentObj) {
}
}
component.layouts[currentLayout].width = width;
component.layouts[currentLayout] = {
...component.layouts[currentLayout],
width,
};
const newComponent = {
component: {
...componentData,