Skip to content

[pull] main from tldraw:main#441

Merged
pull[bot] merged 5 commits intocode:mainfrom
tldraw:main
Mar 11, 2026
Merged

[pull] main from tldraw:main#441
pull[bot] merged 5 commits intocode:mainfrom
tldraw:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Mar 11, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

steveruizok and others added 5 commits March 11, 2026 15:29
Closes #8205

In order to let users copy selected shapes as raw JSON for debugging,
scripting, and sharing, this PR adds `'json'` as a new `TLCopyType`
format. When selected from the copy-as menu, the shapes and their
bindings are serialized via `editor.getContentFromCurrentPage()` and
placed on the clipboard as plain text.

The JSON menu item only appears when debug mode is enabled.

### Change type

- [x] `feature`

### Test plan

1. Enable debug mode (menu > preferences > debug mode)
2. Draw some shapes on the canvas
3. Select shapes, right-click > Copy as > JSON
4. Paste into a text editor — should see formatted JSON with shape data
and bindings

### Release notes

- Add JSON as a copy-as format (available in debug mode) for copying
selected shapes as stringified JSON to the clipboard.

### API changes

- Added `'json'` to `TLCopyType` union type
- Changed `CopyAsOptions` to extend `Omit<TLImageExportOptions,
'format'>` instead of `TLImageExportOptions` (since `'json'` is not a
valid `TLExportType`)

### Code changes

| Section         | LOC change |
| --------------- | ---------- |
| Core code       | +27 / -4   |
| Automated files | +3 / -3    |

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Adds a new clipboard export path and expands a public union type,
which could affect downstream TypeScript consumers and clipboard
behavior across browsers. Scope is limited and gated behind debug mode
in the UI.
> 
> **Overview**
> Adds a new **debug-only** `Copy as JSON` option that serializes the
selected (or all page) shapes via `editor.getContentFromCurrentPage()`
and writes the formatted JSON string to the clipboard.
> 
> Extends `TLCopyType` to include `json` and adjusts `CopyAsOptions` to
`Omit<TLImageExportOptions, 'format'>` so image-export options remain
valid while supporting the new text-based format; updates menu actions
and translation keys/strings accordingly.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
454fa77. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
In order to reduce GitHub Actions cache storage from ~1.1GB per PR to
~300MB shared, this PR changes the setup action to cache only
`.yarn/cache` and `.yarn/install-state.gz` (dropping `node_modules` and
`.yarn/unplugged`), use restore-only caching on PRs via
`actions/cache/restore`, and save the cache only on pushes to main via
`actions/cache/save`.

Relates to #7628

### Change type

- [x] `improvement`

### Test plan

1. Verify CI passes on this PR (cache restore still works from main's
existing entry)
2. After merging, confirm new cache entries on main are ~300MB instead
of ~1.1GB
3. Clean up old `Linux-node-24.13.1-yarn-*` cache entries from the
Actions cache page

### Code changes

| Section        | LOC change |
| -------------- | ---------- |
| Config/tooling | +14 / -6   |

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> CI-only caching behavior change; main risk is slower installs or cache
misses if keys/paths are misconfigured, with no production/runtime
impact.
> 
> **Overview**
> The CI `setup` composite action switches from caching `node_modules`
to caching only Yarn’s `.yarn/cache` and `.yarn/install-state.gz`,
reducing cache size and avoiding per-branch duplication.
> 
> It now uses `actions/cache/restore@v5` to restore caches for all runs,
and conditionally saves the cache via `actions/cache/save@v5` only on
`push` events to `refs/heads/main` (and only when the restore wasn’t a
hit).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
45d8053. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
just for fun!



https://github.com/user-attachments/assets/6660bf1a-2574-441a-bfd7-6ca89f34ed97



### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Changes are isolated to the `apps/examples` app and primarily add a
new demo plus dependencies; main risk is build/bundle impact from new
D3/TopoJSON packages.
> 
> **Overview**
> Adds a new `use-cases/d3-map` example that renders a projected US map
as a custom `us-map` shape and lets users *explode* it into per-state
`us-state` shapes (atomic/undoable), plus a top-panel reset action.
> 
> Introduces map data generation in `us-map-data.ts` using `d3-geo` +
`topojson-client` with `us-atlas` topology, and adds styling for the
explode/reset UI.
> 
> Updates `apps/examples` dependencies and `yarn.lock` to include
D3/TopoJSON/US atlas packages and their TypeScript types.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
fffd421. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…pes (#8192)

When pasting tldraw clipboard data into an editable text shape (e.g. a
geo shape label or note), the paste was silently blocked. This PR fixes
it to extract and insert the plain text content from the clipboard
instead.

fixes #8187

### Change type

- [x] `bugfix`

### Test plan

1. Create two shapes with text (e.g. geo shapes with labels)
2. Select and copy one shape (Cmd+C)
3. Double-click the other shape to edit its text
4. Paste (Cmd+V) — the plain text from the copied shape should be
inserted

### Release notes

- Fix pasting into editable text shapes when clipboard contains tldraw
data


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: a small, localized change to paste handling for editable
text, with minimal impact outside the specific tldraw-clipboard paste
path.
> 
> **Overview**
> Fixes paste into editable text shapes when the clipboard contains
tldraw HTML data. Instead of silently blocking the paste,
`useEditablePlainText` now prevents the default and inserts the
clipboard’s `text/plain` content via
`document.execCommand('insertText')` to preserve undo support.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0fa808b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Ani Krishnan <98394024+anikrisn@users.noreply.github.com>
In order to prevent crashes when isolating curved arrows with degenerate
geometry, this PR hardens the arrow binding update logic to handle cases
where rebend geometry becomes invalid.

When a curved arrow's geometry becomes degenerate (e.g., during shape
deletion), the strict intersection assert could fire and the terminal
update could write `NaN` values. This PR removes the strict assert,
guards against zero-length direction vectors, and skips bend
recomputation when inputs are non-finite. Arrow terminal updates now
fall back to stored `arrow.props.start/end` when computed points are
invalid.

Fixes #8174.

### Change type

- [x] `bugfix`

### Test plan

1. Create two adjacent shapes and draw a bent (curved) arrow between
them
2. Delete the arrow — should not crash
3. Verify curved arrows still render and update correctly during normal
editing

- [x] Unit tests

### API changes

- Added `Vec.IsFinite()` static method for checking if a vector has
finite coordinates

### Release notes

- Fix crash when isolating curved arrows with degenerate binding
geometry

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches arrow binding/geometry update logic that runs during edits and
deletions; added guards reduce crash risk but could subtly change bend
recomputation behavior in edge cases.
> 
> **Overview**
> Fixes a crash path in curved arrow binding updates by making
`updateArrowTerminal` resilient to degenerate geometry during
isolation/deletion.
> 
> Terminal point updates now *fallback to `arrow.props.start/end`* when
computed points are non-finite, bend recomputation is skipped for
zero-length directions or non-finite arc inputs, and the strict
intersection assertion is replaced with best-effort intersection
selection. Adds `Vec.IsFinite()` to the public editor API and a
regression test covering deletion of a bent arrow bound between two
adjacent shapes.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5fdfda1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@pull pull Bot locked and limited conversation to collaborators Mar 11, 2026
@pull pull Bot added the ⤵️ pull label Mar 11, 2026
@pull pull Bot merged commit b54d7b5 into code:main Mar 11, 2026
@pull pull Bot had a problem deploying to deploy-staging March 11, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-production March 11, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-staging March 11, 2026 21:13 Failure
@pull pull Bot had a problem deploying to vsce publish March 11, 2026 21:13 Failure
@pull pull Bot had a problem deploying to deploy-staging March 11, 2026 21:13 Error
@pull pull Bot had a problem deploying to deploy-staging March 12, 2026 00:25 Failure
@pull pull Bot temporarily deployed to e2e-dotcom March 12, 2026 02:36 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants