this PR does a couple of things when creating bookmarks
- any time a url was pasted it was previously calling `fetch` on the url
to check whether the url is an image that we have cors access to. In
that case we can paste the image itself rather than a bookmark. But
that's gonna be a relatively rare use case, and the check itself seemed
to cost anywhere from 200ms to +1s which is certainly not worth it when
the fallback behaviour (create a regular bookmark) is fine. So i moved
that check behind a url pathname extension check. i.e. if the url
pathname ends with .gif, .jpg, .jpeg, .svg, or .png, then it will check
whether we can paste the image directly, otherwise it will always do a
regular bookmark.
- we create an asset-less bookmark shape on the canvas while we wait for
the asset to load if it is not already available. This means the user
gets immediate feedback that their paste succeeded, but they won't see
the actual bookmark details for a little bit.
It looks like this
![Kapture 2023-11-08 at 10 34
35](https://github.com/tldraw/tldraw/assets/1242537/89c93612-a794-419f-aa68-1efdb82bfbf2)
### Change Type
- [x] `minor` — New feature
### Release Notes
- Improves ux around pasting bookmarks
**Before**
![image](https://github.com/tldraw/tldraw/assets/2523721/161bc39b-f657-4983-8eaa-7de61c87b3bb)
**After**
![image](https://github.com/tldraw/tldraw/assets/2523721/f75794ce-96a1-4a9e-914d-cc9664702b6b)
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Create an arrow.
2. Hover over the arrow head style dropdowns. They should be correctly
translated.
3. Also test it for when you have arrows with different styles selected.
This should show the `mixed` option.
### Release Notes
- Fix arrow headstyle dropdown translations.
This PR fixes a bug with zero length arrows.
Before:
![2023-11-07 at 15 17 47 - Harlequin
Mouse](https://github.com/tldraw/tldraw/assets/15892272/4c0b9609-f4f0-49cc-8575-ffd58973e81f)
After:
![2023-11-07 at 15 30 07 - Scarlet
Dinosaur](https://github.com/tldraw/tldraw/assets/15892272/af3188f1-c996-46e1-a2ff-48de31e0fc05)
Fixes#2166
### Change Type
- [x] `patch` — Bug fix
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Draw a rectangle.
2. Clone it.
3. Connect their centers with an arrow.
4. Hold control/command.
5. Drag one rectangle onto the other so they're in the exact same place.
6. Erase both rectangles (but NOT the invisible arrow).
7. Select all.
8. Hover the minimap.
9. Repeat but curve the arrow slightly before moving the rectangles
together.
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Fix a hyper niche arrow crash with zero length arrows.
Allows you to start brush selecting shapes on top of a locked shapes. In
this case we treat the click on top of the locked shape as if we clicked
on the canvas (we transition from `idle` -> `pointing_canvas`).
Fixes https://github.com/tldraw/tldraw/issues/2158
Before:
https://github.com/tldraw/tldraw/assets/2523721/7d6eb237-e084-4c40-b777-21d4a67fc796
After:
https://github.com/tldraw/tldraw/assets/2523721/0a73d1da-8250-4ba0-90ee-47d3e794a813
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Add a locked shape (for geo shape it should have some background)
2. Add a few shapes on top of that shape.
3. Start draging on top of the locked shape. You should be able to brush
select other shapes.
- [x] Unit Tests
- [ ] End to end tests
### Release Notes
- Allows brush selecting when you start it on top of a locked shape.
Seems like the `HTMLContainer` didn't have the correct size, so text
label was positioned a bit further up than it should be.
Fixes [#2156](https://github.com/tldraw/tldraw/issues/2156)
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Create a small geo shape
2. Add some text to it. Test it with text that wraps to new lines.
3. Make sure text is centred.
### Release Notes
- Fixes position of Text labels in geo shapes.
This improves how zooming works when we zoom in an inactive window. With
this change you should zoom towards the pointer position, while before
it zoomed towards the last known pointer position before the window
became inactive.
Fixes#2165
Before
https://github.com/tldraw/tldraw/assets/2523721/50018782-533a-43bb-88a5-21fc4419b723
After
https://github.com/tldraw/tldraw/assets/2523721/c3859f84-ef56-4db8-96b9-50a2de060507
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Open the tldraw editor.
2. Click away from the browser window so that it's not longer active.
3. Hover over the browser window and start zooming.
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Improves zooming for inactive windows.
This PR adds two new component overrides to the editor's `components`
slot. They are:
- `<OnTheCanvas/>`, which renders inside of the html layer that scales
and translates with the camera
- `<InFrontOfTheCanvas/>`, which renders in front of the canvas but
behind any UI elements, and which does not scale / pan with the camera.
![Kapture 2023-11-06 at 12 19
15](https://github.com/tldraw/tldraw/assets/23072548/51c0421d-8b39-48b5-9b8a-c717253c3423)
### Change Type
- [x] `minor` — New feature
### Test Plan
1. See the "on the canvas" example.
### Release Notes
- [editor] Adds two new components, `OnTheCanvas` and
`InFrontOfTheCanvas`.
This switches us from the 'alpha' to 'beta' prerelease tag. After we
make our first deploy folks will be able to install the latest version
by doing `npm install @tldraw/tldraw@beta`.
### Change Type
- [x] `internal` — Any other changes that don't affect the published
package[^2]
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
New VS Code extension release.
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Release Notes
- Release a new version of VS Code extension with all the latest
changes.
Fixes a bug with our cleanupText helper where it fails on the empty
string or string with only space character(s).
Fixes https://tldraw.sentry.io/issues/4593272987
### Change Type
- [x] `patch` — Bug fix
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Add a step-by-step description of how to test your PR here.
2.
- [x] Unit Tests
- [ ] End to end tests
### Release Notes
- Fixes a minor bug where cleaning up text would fail.
This PR adds support for multiple scribbles at the same time. It
prevents the sudden disappearance of existing scribbles when new ones
are added. It simplifies the management of scribbles by moving the
scribble manager to the editor.
![Kapture 2023-10-29 at 10 17
48](https://github.com/tldraw/tldraw/assets/23072548/23089047-6247-4714-bb79-c4972370140f)
### Change Type
- [x] `minor` — New feature
### Test Plan
1. Use the eraser, scribble select, and laser pointer tools
- [x] Unit Tests
### Release Notes
- [feature] multi scribbles
This PR fixes the CSS styling for the editing page title on mobile.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. View the page menu on mobile.
2. Start editing the pages.
3. The page title should not move.
This PR is a fork of #2119
It only has one of the two changes:
* Remove indicator for autosize text shapes while editing.
![2023-10-26 at 13 55 56 - Chocolate
Anaconda](https://github.com/tldraw/tldraw/assets/15892272/ee54db05-e96d-40e6-8003-cc013894f6f9)
I think we should merge this one, and continue discussion of the other
one (alignment).
### Change Type
- [x] `minor` — New feature
### Test Plan
1. Click to draw a text shape.
2. You shouldn't see the shape's indicator while editing it.
3. Drag to draw a text shape.
4. You *should* see the shape's indicator while editing it.
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Removed the indicator from autosize text shapes.
This PR adds a meta example, showing how to add meta properties to
shapes.
### Change Type
- [x] `documentation` — Changes to the documentation only[^2]
This PR passes the initial shape to the onHandleChange method. It makes
it a bit easier to work with handles in custom shapes.
### Change Type
- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [x] `internal` — Any other changes that don't affect the published
package[^2]
- [] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Add a brief release note for your PR here.
Seems Safari only added `MediaQueryList: change event` in version 14.
This is a workaround for older versions.
https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/change_event
Reported here
https://discord.com/channels/859816885297741824/926464446694580275/1166028196832092282
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Release Notes
- Fixes an issue with `addEventListener` on MediaQueryList object in old
versions of Safari.
Uses the dpr trick on the selection foreground. Looks like the
background doesn't need this.
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Release Notes
- Fixes a small issue causing the selection foreground to be offset when
the browser is at particular zoom levels.
This PR removes all mentions of "(optional)" from our jsdocs. This is
for:
* consistency — many of our jsdocs don't mention "(optional)" for
optional parameters. The developer is expected to use the type
definition to find this out. But it's a bit unclear because we use
"(optional)" in many places too.
* docs site — on our docs site, we use type definitions to figure out
what is optional, and what isn't. We use that info to denote optional
parameters. It looks funny having two "(optional)"s on a page. We
*could* strip them, but it's probably better to just remove them at the
source.
<img width="526" alt="image"
src="https://github.com/tldraw/tldraw/assets/15892272/b5b65a2b-2923-42a9-a2d3-9b1d9d55cd3d">
### Change Type
- [x] `documentation` — Changes to the documentation only[^2]
### Release Notes
- dev: Removed duplicate/inconsistent `(optional)`s from docs
This PR fixes a bug where the mobile style panel would be immediately
re-opened when clicking on the style panel icon on mobile.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. On mobile, tap the style panel to open it
2. Tap again to close it.
### Release Notes
- Fix bug with style panel
VS Code extension version bump with the latest changes.
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
This PR places a bandaid over a radix issue.
On firefox, when using a touch screen, certain dropdowns in the style
menu would immediately close after opening. This is because the
'touchup' event was closing them.
We can do a dodgy fix by preventing the touch up event.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. On firefox, use a touch device (this can be firefox devtools on a
mac)
2. Draw an arrow and a geo shape.
3. Select both of them.
4. Open the style menu.
5. Make sure you can open the arrowhead dropdown.
6. Make sure you can open the geo shape type dropdown.
### Release Notes
- Firefox Mobile: Fixed a bug where you couldn't open some style
dropdown options.
closes#2091
Added a little timestamp to filenames so that you don't get asked if you
want to download them again on android devices.
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. export as png
2. export again
3. the two files now have different names, wow!
### Release Notes
- Add timestamp to exported image file names
This PR fixes a bug that causes menus not to close correctly when open.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. On mobile, open the menu.
2. Tap the canvas—it should close the panel.
3. Open the mobile style panel.
4. Tap the canvas—it should close the panel.
5. Open the mobile style panel.
6. Tap the mobile style panel button—it should close the panel.
7. On mobile, long press to open the context menu
### Release Notes
- [fix] bug with menus
This PR fixes a case where you couldn't upload images that are bigger
than the browser's max canvas size.
It does this by resizing them down if they're too big.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
Easiest to test on one of our iPads.
1. Take a photo with the iPad camera. (they're big photos)
2. Insert the photo to the canvas with the 'insert media' tool.
3. It should appear on the canvas!
(You might want to double check that your photo *doesn't* successfully
upload on staging, to make sure it's big enough)
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Fixed big images being too big to get added to the canvas.
closes#2080
### Change Type
- [x] `patch` — Bug fix
### Release Notes
- Fixes a rendering issue where cropped images were sometimes bleeding
outside their bounds.
This PR adds an offline indicator to the UI package. It's not used in
the default app but we'll use it on tldraw.com, and it makes sense to
include it here as it's generally useful.
### Change Type
- [x] `minor` — New feature
### Test Plan
1. See the zones example.
### Release Notes
- [@tldraw/tldraw] add offline indicator to ui components
Fixed a bug checking translated string keys
Suppress the following warning message in your browser.
```
Language zh-cn: missing messages for keys:
locale
label
messages
```
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
This PR removes some calls to `findLast`, as this is not in all browsers
yet.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. Drag and drop.
2. Create a shape inside of a frame
- [x] Unit Tests
Bumps nanoid to bring in line with brivate to make sure our nanoid mock
in our fuzz test works. Supersedes
https://github.com/tldraw/brivate/pull/3027#pullrequestreview-1676280991
### Change Type
- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [x] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
This PR fixes a bug where the indicator on a locked group (or any
shape!) would not appear when the shape was unlocked. This happens
because the `memo` equality checker filtered out changes to the shape's
locked property if they did not effect any other properties.
![Kapture 2023-10-13 at 14 44
31](https://github.com/tldraw/tldraw/assets/23072548/c40442e0-8d18-4ed0-863c-c2b73da81f28)
### Change Type
- [x] `patch` — Bug fix
### Release Notes
- Fix case where indicator was not shown when unlocking groups
This PR fixes (or rather buries) a bug that could occur when the parents
to children array includes shapes that no longer exist.
### Change Type
- [x] `patch` — Bug fix
This PR allows locked shapes to be reparented. This fixes a bug where
grouped and locked shapes would disappear when their parent group would
be ungrouped.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. Create two shapes.
2. Group the shapes.
3. Lock one shape.
4. Ungroup the group
- [x] Unit Tests
### Release Notes
- Fix a bug where grouped locked shapes would be deleted when ungrouped.
This PR fixes a bug where a locked shape could be selected when clicking
the shape's label.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. Place a no-fill geo shape
2. Lock the shape
3. Click on the middle of the shape (its label)
4. It should not be selected (previously it would be)
1. Place a no-fill shape in a frame
2. Lock the shape
3. Click on the middle of the shape or the edge of the shape
4. It should not be selected (previously it would be)
- [x] Unit Tests
### Release Notes
- Fix bug where locked shape could be selected by clicking on its label
This PR changes the default state of the editor to use `page:page` as
its first page's id. This removes some randomness that makes certain
seed-based tests impossible. It should have no effect on the way that
the app works.
### Change Type
- [x] `minor` — New feature
locked shape of opacity problem with the pointing state of the eraser
tool
this is only in the pointing (clicking) state.
I don't know if this is intended or a bug, but it's true that it's a
little uncomfortable.
![blinks](https://github.com/tldraw/tldraw/assets/59823089/6292aa54-120d-4cbc-b712-a78f408d248b)
blinks when the user starts to remove the handwriting on locked content.
Defs https://github.com/tldraw/tldraw/pull/2061
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### Test Plan
1. Make a locked shape
2. Click erase over the shape
3. The shape shouldn't change opacity
### Release Notes
- locked shape of opacity problem with eraser.pointing
Before/after:
![A](https://github.com/tldraw/tldraw/assets/59823089/7483506c-72ac-45cc-93aa-f2a794ea8ff0)
![B](https://github.com/tldraw/tldraw/assets/59823089/ef0f988c-83f5-46a2-b891-0a391bca2f87)
Previous implementation was incorrect, causing the following bug:
![image](https://github.com/tldraw/tldraw/assets/26308297/03f2a996-dd58-4864-8f89-8e7af2ecca69)
### Change Type
- [] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [x] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
---------
Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
Adds caching for playwright browsers, should make the e2e tests run much
faster.
![CleanShot 2023-10-11 at 13 06
48](https://github.com/tldraw/tldraw/assets/2523721/6eb7fb00-d70e-4019-9e81-736b2a19e1bb)
Here's how it looks like when there's a cache hit (added an empty commit
to this PR to test it out)
![CleanShot 2023-10-11 at 13 19
30](https://github.com/tldraw/tldraw/assets/2523721/b6a2cfcf-8322-413f-822b-8ed211f5c9a3)
### Change Type
- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [x] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
Update VS code extension version and changelog.
### Change Type
- [x] `internal` — Any other changes that don't affect the published
package[^2]
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
Closes#2051
This was another bug related to the usage of parent-scope `let`
assignments to avoid stack allocations in a hot code path, so I switched
to `const`s and local `let`s which we really should have done last week.
I think the compiler should be able to optimize this well enough.
### Change Type
- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
### 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
- Fixes opacity of shapes while erasing in a group or frame.
This PR fixes a bug where certain hit tests would always miss straight
lines.
### Change Type
- [x] `patch` — Bug fix
### Test Plan
1. Create a straight line.
2. Try to bind an arrow to it.
- [x] Unit Tests
### Release Notes
- [fix] Bug where arrows would not bind to straight lines