Skip to content

fix(editor): reparent pasted shapes into frame when they land inside one#7938

Merged
steveruizok merged 1 commit intomainfrom
fix/paste-reparent-into-frame
Feb 15, 2026
Merged

fix(editor): reparent pasted shapes into frame when they land inside one#7938
steveruizok merged 1 commit intomainfrom
fix/paste-reparent-into-frame

Conversation

@steveruizok
Copy link
Copy Markdown
Collaborator

@steveruizok steveruizok commented Feb 14, 2026

Closes #5918

When shapes are pasted (Ctrl+V) and pasteParentId resolves to the current page (e.g. nothing is selected, or selected shapes share the page as their common ancestor), shapes are positioned at the viewport center or their original position but no check is made for whether they landed inside a frame. This causes z-ordering confusion: notes added to the frame stay behind the misparented shapes, and sending those shapes to back hides them behind the frame.

This PR adds a post-positioning reparent check in putContentOntoCurrentPage. After shapes are positioned, if the paste parent is the page, we compute the center of all pasted root shapes and use getShapeAtPoint to find a frame at that center — the same approach already used for paste-at-point. If a frame is found, the root shapes are reparented into it. The pasted shapes themselves are excluded from being considered as parents to prevent frame-into-self reparenting.

Kapture.2026-02-15.at.00.33.30.mp4

Change type

  • bugfix

Test plan

  1. Create a frame on the canvas
  2. Create a shape outside the frame, select it, copy it (Ctrl+C)
  3. Deselect all shapes
  4. Pan so the viewport is centered on the frame
  5. Paste (Ctrl+V) — the shape should become a child of the frame
  • Unit tests

Release notes

  • Fixed shapes pasted with Ctrl+V not being parented to a frame when they land inside one.

Note

Medium Risk
Changes paste parenting behavior by auto-reparenting shapes after they’re positioned, which can affect hierarchy/z-order outcomes in edge cases with overlapping frames or groups; covered by new unit tests.

Overview
Fixes paste behavior so that when content is pasted onto the page (i.e. no explicit paste parent), the editor post-processes the newly positioned root shapes and automatically reparents any that ended up inside a frame using getDroppedShapesToNewParents + reparentShapes.

Adds unit tests covering reparenting when pasting at viewport center and with preservePosition, and updates an ordering expectation in paste.test.ts to reflect the new frame-overlap reparenting behavior.

Written by Cursor Bugbot for commit 491d54e. This will update automatically on new commits. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Feb 15, 2026 0:06am
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Preview Feb 15, 2026 0:06am
chat-template Ignored Ignored Preview Feb 15, 2026 0:06am
tldraw-docs Ignored Ignored Preview Feb 15, 2026 0:06am
tldraw-shader Ignored Ignored Preview Feb 15, 2026 0:06am
workflow-template Ignored Ignored Preview Feb 15, 2026 0:06am

Request Review

@steveruizok steveruizok removed this pull request from the merge queue due to a manual request Feb 14, 2026
@steveruizok steveruizok force-pushed the fix/paste-reparent-into-frame branch from 3dce87c to 2f39382 Compare February 14, 2026 23:52
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

When shapes are pasted with Ctrl+V and no specific point or parent is
determined (e.g. nothing selected), the shapes land at the viewport
center or their original position but are never checked for whether
they visually overlap a frame. This causes z-ordering issues where
notes added to the frame appear behind the misparented shapes.

After positioning pasted shapes, check whether their center lands
inside a frame that can accept children. If so, reparent them into
that frame. This mirrors the existing behavior for paste-at-point.

Closes #5918
@steveruizok steveruizok force-pushed the fix/paste-reparent-into-frame branch from 2f39382 to 491d54e Compare February 15, 2026 00:03
@steveruizok steveruizok added this pull request to the merge queue Feb 15, 2026
Merged via the queue into main with commit 2bce131 Feb 15, 2026
18 checks passed
@steveruizok steveruizok deleted the fix/paste-reparent-into-frame branch February 15, 2026 20:01
github-merge-queue bot pushed a commit that referenced this pull request Feb 16, 2026
In order to keep release documentation current after the v4.3.2 patch
release, this PR updates both the archived and next release notes.

### Changes

**v4.3.0.mdx:**
- Add GitHub release link for v4.3.0
- Add v4.3.1 patch section (draw shape delta encoding precision fix)
- Add v4.3.2 patch section (custom shape crop fix)

**next.mdx:**
- Update `last_version` from v4.3.1 to v4.3.2
- Add bug fix entries for #7938 (paste-into-frame) and #7931 (crop
isCircle)

### Change type

- [x] `docs`

### Test plan

- [ ] Verify release notes render correctly on the docs site

### Release notes

- Update release notes with v4.3.1 and v4.3.2 patch entries

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-only updates to markdown release notes; no runtime code changes,
with minimal risk beyond potential formatting/rendering issues.
> 
> **Overview**
> Updates release documentation to reflect the `v4.3.2` patch.
> 
> Bumps `apps/docs/content/releases/next.mdx` `last_version` to `v4.3.2`
and adds two new bug-fix entries (paste-into-frame parenting and a
custom-shape cropping crash).
> 
> Extends `apps/docs/content/releases/v4.3.0.mdx` with GitHub release
links and a new **Patch releases** section covering `v4.3.1` and
`v4.3.2`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ee7dc07. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
huppy-bot bot pushed a commit that referenced this pull request Feb 16, 2026
In order to keep release documentation current after the v4.3.2 patch
release, this PR updates both the archived and next release notes.

### Changes

**v4.3.0.mdx:**
- Add GitHub release link for v4.3.0
- Add v4.3.1 patch section (draw shape delta encoding precision fix)
- Add v4.3.2 patch section (custom shape crop fix)

**next.mdx:**
- Update `last_version` from v4.3.1 to v4.3.2
- Add bug fix entries for #7938 (paste-into-frame) and #7931 (crop
isCircle)

### Change type

- [x] `docs`

### Test plan

- [ ] Verify release notes render correctly on the docs site

### Release notes

- Update release notes with v4.3.1 and v4.3.2 patch entries

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-only updates to markdown release notes; no runtime code changes,
with minimal risk beyond potential formatting/rendering issues.
> 
> **Overview**
> Updates release documentation to reflect the `v4.3.2` patch.
> 
> Bumps `apps/docs/content/releases/next.mdx` `last_version` to `v4.3.2`
and adds two new bug-fix entries (paste-into-frame parenting and a
custom-shape cropping crash).
> 
> Extends `apps/docs/content/releases/v4.3.0.mdx` with GitHub release
links and a new **Patch releases** section covering `v4.3.1` and
`v4.3.2`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ee7dc07. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shape pasted within frame is not parented to the frame

1 participant