fix(paste): align pre-paste text measurement with final shape geometry#8345
Merged
fix(paste): align pre-paste text measurement with final shape geometry#8345
Conversation
Use the same normalized rich-text HTML for pre-paste measurement that TextShapeUtil uses for final shape geometry, fixing a positioning drift when pasting text. Closes #8343
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
Collaborator
|
Looks good, asking the bot to push a test here. Review that it's checking what matters and then land this one |
Add end-to-end and unit tests to validate pasted text measurement and geometry. The Playwright e2e spec checks that pasted plain, HTML, and multiline text shapes have props.w matching the computed geometry width. The package unit tests spy on textMeasure.measureHtml to ensure the same measurement HTML is used for paste and shape geometry, verify pasted shapes are centered on the paste point, and assert autoSize/textAlign behavior for single- vs multi-line content. These tests guard against mismatches caused by using different HTML for measurement during paste vs geometry computation.
…draw into ani/fix-text-paste-measurement
Remove unit tests that relied on spying on internal measureHtml calls and replace with a single E2E test that verifies the actual invariant: pasting the same text as plain text or HTML produces identical shapes in a real browser. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
tldraw-mcp-app | e3e9af5 | Mar 30 2026, 02:30 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
agent-template | e3e9af5 | Mar 30 2026, 02:30 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
image-pipeline-template | e3e9af5 | Commit Preview URL Branch Preview URL |
Mar 30 2026, 02:35 PM |
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 3, 2026
Adds the standard `Cmd+Shift+V` / `Ctrl+Shift+V` shortcut to paste clipboard content as plain text, skipping HTML and rich content. **Breaking behavior change:** Previously, `Cmd+Shift+V` toggled paste-at-cursor positioning (added in #4088 for Autodesk). Since the "Paste at cursor" preference (#4066) now covers that use case, this repurposes `Cmd+Shift+V` for plain text paste — the standard shortcut in most apps. Users who relied on `Cmd+Shift+V` for paste-at-cursor should use the preference toggle instead. - **Preference off:** `Cmd+V` pastes at center, `Cmd+Shift+V` pastes plain text at center - **Preference on:** `Cmd+V` pastes at cursor, `Cmd+Shift+V` pastes plain text at cursor Note: depends on #8345 for consistent paste positioning between plain text and rich text paste. Closes #8183 ### Change type - [x] `feature` ### Test plan 1. Copy rich text from a web page 2. `Cmd+V` — pastes with formatting (existing behavior, unchanged) 3. `Cmd+Shift+V` — pastes as plain text, no HTML formatting 4. Toggle "Paste at cursor" preference and verify both shortcuts respect it 5. Verify that `Cmd+Shift+V` no longer triggers paste-at-cursor positioning - [ ] Unit tests - [ ] End to end tests ### Release notes - Added `Cmd+Shift+V` / `Ctrl+Shift+V` shortcut to paste clipboard content as plain text - Changed `Cmd+Shift+V` from paste-at-cursor to paste-as-plain-text ### Code changes | Section | LOC change | | -------------- | ----------- | | Core code | +105 / -12 | | Tests | +97 / -0 | | Config/tooling | +1 / -1 | --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes pasted text positioning by measuring the same rich-text HTML that the final text shape renders. Previously, we positioned pasted text using a different pre-measurement format, which could make it land slightly off-center.
Closes #8343
Change type
bugfixTest plan
Note: unit tests won't catch text measurement bugs.
Release notes
Code changes