diff --git a/editor/src/components/canvas/canvas-strategies/post-action-options/navigator-reparent.ts b/editor/src/components/canvas/canvas-strategies/post-action-options/navigator-reparent.ts index b6395db96c77..dc6ce9a94b5c 100644 --- a/editor/src/components/canvas/canvas-strategies/post-action-options/navigator-reparent.ts +++ b/editor/src/components/canvas/canvas-strategies/post-action-options/navigator-reparent.ts @@ -202,7 +202,7 @@ export const PropsReplacedNavigatorReparentPostActionChoice = ( } } -function adjustIntendedCoordinatesForGroups( +export function adjustIntendedCoordinatesForGroups( jsxMetadata: ElementInstanceMetadataMap, reparentTargetPath: ElementPath, intendedCoordinates: CanvasPoint, diff --git a/editor/src/components/canvas/canvas-strategies/post-action-options/post-action-paste.ts b/editor/src/components/canvas/canvas-strategies/post-action-options/post-action-paste.ts index db24163f682d..0d967a0156e9 100644 --- a/editor/src/components/canvas/canvas-strategies/post-action-options/post-action-paste.ts +++ b/editor/src/components/canvas/canvas-strategies/post-action-options/post-action-paste.ts @@ -66,7 +66,7 @@ import { reparentStrategyForPaste } from '../strategies/reparent-helpers/reparen import type { ReparentStrategy } from '../strategies/reparent-helpers/reparent-strategy-helpers' import type { ElementToReparent, PathToReparent } from '../strategies/reparent-utils' import { elementToReparent, getReparentOutcomeMultiselect } from '../strategies/reparent-utils' -import { collectGroupTrueUp } from './navigator-reparent' +import { adjustIntendedCoordinatesForGroups, collectGroupTrueUp } from './navigator-reparent' import type { PostActionChoice } from './post-action-options' interface EditorStateContext { @@ -197,7 +197,15 @@ function pasteChoiceCommon( return { elementPath: elementPaste.originalElementPath, pathToReparent: elementToReparent(elementWithUID.value, elementPaste.importsToAdd), - intendedCoordinates: intendedCoordinates, + intendedCoordinates: adjustIntendedCoordinatesForGroups( + editorStateContext.startingMetadata, + target.parentPath.intendedParentPath, + intendedCoordinates, + MetadataUtils.findElementByElementPath( + pasteContext.elementPasteWithMetadata.targetOriginalContextMetadata, + elementPaste.originalElementPath, + ), + ), newUID: elementWithUID.value.uid, } }) diff --git a/editor/src/components/editor/actions/actions.spec.browser2.tsx b/editor/src/components/editor/actions/actions.spec.browser2.tsx index 329483276bfd..923af496599f 100644 --- a/editor/src/components/editor/actions/actions.spec.browser2.tsx +++ b/editor/src/components/editor/actions/actions.spec.browser2.tsx @@ -1586,9 +1586,9 @@ describe('actions', () => {