25dcc29803
This PR aims to improve the UX around undo/redo and cropping. Before the PR if you do some cropping, then stop cropping, then hit `undo`, you will end up back in the cropping state and it will undo each of your resize/translate cropping operations individually. This is weird 🙅🏼 It should just undo the whole sequence of changes that happened during cropping. To achieve that, this PR introduces a new history method called `squashToMark`, which strips out all the marks between the current head of the undo stack and the mark id you pass in. This PR also makes the default history record mode of `updateCurrentPageState` to `ignore` like it already was for `updateInstanceState`. The fact that it was recording changes to the `croppingShapeId` was the reason that hitting undo would put you back into the cropping state. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Add a brief release note for your PR here. |
||
---|---|---|
.. | ||
assets | ||
dotcom-shared | ||
editor | ||
namespaced-tldraw | ||
state | ||
store | ||
tldraw | ||
tlschema | ||
tlsync | ||
utils | ||
validate |