forked from tldraw/tldraw
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pull] main from tldraw:main #1
Open
pull
wants to merge
2,347
commits into
fork-house:main
Choose a base branch
from
tldraw:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
❌ Deploy Preview for rafids-tldraw failed.
|
Fix the imported css in the docs. ### Change type - [x] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Test plan No tests added - [ ] Unit tests - [ ] End to end tests ### Release notes - Fixed a bug with tutorial documentation QuickStart. It did not import 'tldraw/tldraw.css' in the code snippet
This PR adds a maximum limit to the number of files a user can create. It adds a (provisional?) config property to the app for these constants. ### Change type - [x] `other` Co-authored-by: Mitja Bezenšek <[email protected]>
Update vite. Maybe this fixes that aborted loading thing ### Change type - [x] `other`
Organize file paths. Should help us stay a bit more consistent when defining and using paths of our app. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Help with tla route / paths organization.
Declutter the printout in CI. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Declutter the printout for e2e tests in CI.
This PR makes it so that - if you visit a URL for a private file and you are signed out, you see this <img width="546" alt="image" src="https://github.com/user-attachments/assets/1cd546e2-6b95-478f-be8e-51166635de1c"> Before this PR you'd be redirected immediately to a sign in page, which is disorienting and not necessarily what the user should have to do. - If you visit a URL for a private file and you are signed in, you see this. <img width="1137" alt="image" src="https://github.com/user-attachments/assets/39bd8f5c-ad31-4571-b923-be4a766d3e20"> Before this PR you would see a flash of the sidebar and then it'd immediately disappear, after which you'd only see the error message with a 'return to tldraw' link that took you back to `/`. In order to achieve all this I had to do some minor refactorings which I'll write up on monday. ### Change type - [x] `other`
Fixed loading of published snapshots. ### Change type - [x] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Fix loading of published snapshots.
### Change type - [x] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` ### Release notes - Fix NPE bug with release pages on docs
The user thing wasn't hooked up to sync properly ### Change type - [x] `other`
The app was going into error mode when the ipad went to sleep. let's see if this fixes it. ### Change type - [x] `bugfix` ### Release notes - Fixed a bug causing the app to crash on ipad when the ipad goes to sleep.
Added event tracking for: - [x] File share menu - invite and publish tabs - [x] Anon landing page - [x] Account menu - [x] sidebar - [x] Delete file dialog - [x] rename action in file menu ### Change type - [ ] `bugfix` - [ ] `improvement` - [x] `feature` - [ ] `api` - [ ] `other` ### Test plan 1. Create a shape... 2. - [ ] Unit tests - [ ] End to end tests ### Release notes - Fixed a bug with…
We now store all the published snapshots so that we could expose published file history in the future. The way it works is: * `/parentSlug/publishedSlug` aways contains the latest published snapshot * we now also store the snapshot under `/parentSlug/publishedSlug|timeOfPublish` to keep track of all the published changes. These can later be retrieved by listing everything under the `parentSlug`: ```ts const publishedRoomSnapshots = await env.ROOM_SNAPSHOTS.list({ prefix: getR2KeyForRoom({ slug: `${parentSlug}`, isApp: true }), }) ``` ![CleanShot 2024-10-30 at 12 20 12@2x](https://github.com/user-attachments/assets/4f161a3f-9ba6-4c88-b267-bf4246c7340f) Resolves INT-414 ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Store all the published snapshots instead of only the latest one.
This starts rethinking our i18n story, at least at the botcom level. - introduces (brings back) `react-intl` which lets start doing more complex translations (being able to include HTML in sentences), do pluralization, time, etc. - adds a i18n middle layer to auto-generate ID's based on their hash, otherwise annoying to do this. - you can see the different uses, there is the `<F>` tag for translated React items - in other cases, you use `defineMessages`/`formatMessage` for things like alt/aria-labels/tooltips. - adds some hidden languages like "accented" to show which where things are untranslated. - similarly, adds a debug mode to add an annoying red text shadow to highlight things that are untranslated. - also adds a looooooong language for languages like German where things start breaking the UI (basically tests UI to where we should have some ellipsis or other considerations) - i18n cheat sheet: https://www.notion.so/tldraw/i18n-cheat-sheet-1223e4c324c080cf8e64c2b67f47378f This has a new App-level set of debug items btw: <img width="1500" alt="Screenshot 2024-10-25 at 23 02 44" src="https://github.com/user-attachments/assets/f0c24503-42aa-4dd5-8047-64ebffb661c0"> ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` --------- Co-authored-by: alex <[email protected]>
Resets the db between tests. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Isolates tests by resetting the db.
Add sharing tests (inviting and publishing). ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Add sharing tests (inviting and publishing).
related to #4822 avoid this missing icon: <img width="447" alt="Screenshot 2024-10-29 at 14 14 11" src="https://github.com/user-attachments/assets/8f67ee07-fba4-4406-b674-f787b3ce5599"> ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
this makes the rooms unlisted, not private by default. the ID is not guessable which gives privacy but doesn't ruin / complicate the UX flow of sharing the file with someone. ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
this adds `readonlyOk` to a bunch of places. lemme know if there are concerns here but i think this should be ok, if we plan on keeping the sidebar around for published+logged in. ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
`ensureStoreIsUsable` is marked internal and should probably stay that way? But it makes sense to always call it after `mergeRemoteChanges` (which we already do) ### Change type - [x] `improvement` ### Release notes - Add store consistency checks during `mergeRemoteChanges`
This PR includes a handful of changes designed to improve the site's performance in search. This includes: - tightening up meta tags in head - adding some visually hidden HTML content - adding a minimal sitemap - moving core styles into a style tag so that things don't load wrong prematurely If you have any other thoughts, let's try them! ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
This PR stubs a few more end to end tests as todos. ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
This PR allows for better control over scale when using the image export utilities in tldraw. - `scale` is used for just the output scale of an image, relative to the size in tldraw - `pixelRatio` is used for the pixelRatio scale, default is 2 A shape that is 100x100 in tldraw: - with { scale: 1 } should export as a 100x100 svg - with { scale: 2 } should export as a 200x200 svg - with { scale: 1, pixelRatio: 1 } should export as a 100x100 png at 72dpi - with { scale: 1, pixelRatio: 2 } should export as a 200x200 png at 144dpi - with { scale: 2, pixelRatio: 2 } should export as a 400x400 png at 144dpi Note, I tried deprecating scale instead of renaming to avoid the breaking change, but I don't think we can get away with that since it gets spread in from other places (where scale is used for actual 1x 2x scale). ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [x] `api` - [ ] `other` ### Test plan 1. Export an image at scale 1. 2. Export an image at scale 2. 2. Export an image at scale 3. ### Release notes - Improved treatment of `scale` in image copy / export utilities.
This was asked on discord https://discord.com/channels/859816885297741824/1298916572093612062/1298916572093612062 let's let people turn off text creation on double click? ### Change type - [x] `feature` ### Release notes - Add option to disable text creation on double click `createTextOnCanvasDoubleClick` --------- Co-authored-by: Steve Ruiz <[email protected]>
followup to #4684 and #4686 was on my todo list to restore some of the responsiveness, esp. on slower networks https://github.com/user-attachments/assets/6a52039d-40b0-4d4b-98f4-fde08665dfa2 ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` --------- Co-authored-by: Steve Ruiz <[email protected]>
#4694 introduced a regression whilst fixing a bug. #4749 fixed that regression whilst regressing the bug that #4694 was meant to fix. this diff fixes both bugs. ### Change type - [x] `bugfix` ### Release notes - Prevent arrows being clipped incorrectly when multiple tldraw instances or exports are present in the dom.
This PR removes focus outlines on buttons. There are persistent bugs with menu items that look cheap and bad and which we haven't been able to solve. If we solve them then we can bring back the outlines. ![Kapture 2024-11-05 at 09 29 41](https://github.com/user-attachments/assets/063cc2e4-032c-47b7-981a-761729b79951) ### Change type - [x] `bugfix` ### Release notes - Fixed a bug with focus outlines appearing in menu items at the wrong time.
This PR fixes shapes getting stuck in the 'erasing' state. ### Change type - [x] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Test plan See: #4860 - [ ] Unit tests - [ ] End to end tests ### Release notes - Fixed a bug with shapes getting stuck in the translucent erasing state.
finds all the strings in botcom and integrates them into the new system ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
Adds: - Bengali - Greek - Gujarati - Kannada - Khmer - Malay - Malayalam - Marathi - Dutch - Punjabi - Tamil - Filipino (Tagalog) - Urdu Removes (which weren't being translated anyway): - Kurdish (ku) - Burmese (Myanmar) (my) ### Change type - [ ] `bugfix` - [ ] `improvement` - [x] `feature` - [ ] `api` - [ ] `other` ### Release notes - i18n: add top 40 languages into the list
gu → gu-in km → km-kh to match what's in Lokalise ### Change type - [x] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other`
Just a single letter typo fix ### Change type - [x] `other`
### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
This PR remove the `q` prefix for tla routes, but if you go to `/q` or `/beta` you will be met with a very basic sign-in page. when you sign in, you get the tla routes instead of the legacy routes. We can share this link on twitter or whatever when we want to let people in. (need to update the clerk settings to allow non-tldraw.com emails first) ### Change type - [x] `other`
When a logged in user visits a legacy multiplayer room (`/q/r/roomId`) they can now click the `Copy to my files` button to slurp the multiplayer room to a file that gets created. This currently reuses all the existing assets - the files don't get re-uploaded. We will need to re-upload them so that we will be able to associate them with the user. Decided to skip this step for now and come back to it once we have the assets/user/file associations ready. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Test plan 1. Create a legacy multiplayer room. 2. Login to the app and use the multiplayer room link, but prefix it with `/q` (so something like `/q/r/roomId` 3. Click the `Copy to my files` button. 4. You should now see the same contents in the newly created file.
We were not doing this properly ### Change type - [x] `other`
apparently it is necessary to call .close on the server socket to make the tcp connection close cleanly, even after the client has called .close() ? before ![Kapture 2025-01-14 at 11 27 52](https://github.com/user-attachments/assets/a13c5061-48d8-401e-84c4-151fd864c4c9) after ![Kapture 2025-01-14 at 11 26 22](https://github.com/user-attachments/assets/6133080e-e7da-410b-a6ef-283a00d8e898) ### Change type - [x] `improvement` ### Release notes - sync: close the server sockets on disconnect to proactively clean up socket connections.
before ![Kapture 2025-01-14 at 15 46 34](https://github.com/user-attachments/assets/b8100c3a-526a-4bd7-9b5f-9eb8897d9deb) after ![Kapture 2025-01-14 at 15 45 15](https://github.com/user-attachments/assets/a08d25d3-0305-456e-8a61-b0aa29ac2512) ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
In #4771, we tweaked how we read from the clipboard on native paste events. When we've written to the clipboard, the clipboard API lets us read that data back more accurately. When copying from the users local filesystem though, files currently aren't exposed through the clipboard API. This tweaks our paste code to still go first to the clipboard API, but if it doesn't find anything very interesting there, it falls back to the event files instead. Unfortunately, this is an inconsistency between pasting with the keyboard, and pasting with the UI. We cannot currently access these files at all through the UI, as that must use the clipboard api. ### Change type - [x] `bugfix` ### Release notes - Fix pasting files copied from the local filesystem with cmd-v
Gets our existing `trackEvent` infra set up to start sending events into posthog. This involves a cookie consent banner and cookie management dialog for logged-in users. For signed out users (or users who haven't opted into analytics) data is recorded anonymously. ### Change type - [x] `other`
This PR begins to address some pains we've felt with regard to logging on cloudflare workers: 1. a console.log invocation is only flushed to the console (or cf dashboard) once a request completes. so if a request hangs for some reason you never see the log output. 2. logs are very eagerly sampled, which makes it hard to rely on them for debugging because you never know whether a log statement wasn't reached or whether it was just dropped. so this PR - adds a Logger durable object that you can connect to via a websocket to get an instant stream of every log statement, no waiting for requests to finish. - wraps the Logger durable object with a Logger class to consolidate code. The logger durable object is on in dev and preview envs, but is not available in staging or production yet because that would require auth and filtering user DO events by user. You can try it on this PR by going to https://pr-5219-preview-deploy.tldraw.com/__debug-tail and then opening the app in another tab also tackles https://linear.app/tldraw/issue/INT-648/investigate-flaky-preview-deploys somewhat ### Change type - [x] `other`
This stuff was a little too personal. kinda gave off "we wanna spy on you" vibes. ### Change type - [x] `other`
Bad mutations that happen on one tab should not incur toasts on all tabs. ### Change type - [x] `other`
#5201) This PR solves the issue #5188. Throwing an error for the case when a user is trying to upload more files than maxFilesAtOnce is replaced with toast. _(for testing purposes and screen recording, I reduced the max amount of files)_ https://github.com/user-attachments/assets/b7468fd0-f14f-41c0-96d9-01f7326a0ecd P.S.: I'm not sure about the correction of the text, so feel free to notify me, and I'll change it :) ### Change type - [x] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - added toast instead of throwing an error for the case when the amount of files is bigger than `maxFilesAtOnce`
After starting to review #5211 it struck me that I didn't have information when I was trying to look at Sentry to see what conditions caused the bug. This adds more context for Sentry when debugging things. (I'm guessing for this particular bug, I _think_ it might be when two people are collaborating, one person is resizing and then the shape is erased underneath them, but it's a guess). Edit: I didn't see we had `createErrorAnnotations` - I'm adding more to that function now. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other`
### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
closes #4391 too ### Change type - [x] `bugfix` ### Release notes - Fixed a bug where grid mode and other settings would not persist across page reloads.
these text inputs have weird behavior on iOS and anyway it's better to show a native prompt. ### Change type - [x] `other`
### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
Over the last few weeks we've had a lot of requests on discord around asset resolution, exports, and the two together. Some of the APIs here have evolved and change independently of each other over time, so I wanted to take a pass at making them make sense with each other a bit more. There are a few things going on in this diff: 1. **BREAKING** The export/copy-as JSON option has been removed. I think this was only ever there as a debug helper, and it's impossible to actually make use of the JSON once copied (it's not the same as .tldr json which confuses people). 2. `exportToBlob` is deprecated in favour of a new `Editor.toImage` method. `exportToBlob` has been the canonical 'turn the canvas into an image' helper for a while, but it has quite a weird looking signature and isn't very discoverable. 3. the `copyAs` and `exportAs` helpers have had a couple of args merged into the options bag for consistency. 4. The `jpeg` format has been removed from `copyAs`. This is technically a breaking API change, but since it never actually worked anyway due to browser limitations i think its fine. 5. SVG exports now resolve assets according to how they'll be used: - if it's for an SVG, we still use the existing `shouldResolveToOriginal` behaviour - if it's for a bitmap export, we request an image downscaled according to the size it will appear in that resulting bitmap. 6. Better reference docs for several APIs around this stuff. 7. **BREAKING** the `useImageOrVideoAsset` hook now requires passing in `width`, instead of reading `shape.props.w`. This is so it can be used with shapes other than our own. Whilst this is technically a breaking change, this limitation means its unlikely that it was used with many custom shapes in practice. 8. The clamping that we used to apply in to `steppedScreenScale` in `resolveAssetUrl` has been moved to our own implementations of `TLAssetStore`. This is so implementors can make their own decisions about the range of scalings they might want to use. 9. The `steppedScreenScale` limit changed from 1/8 to 1/32. This is because when testing with full res photos from a modern smartphone, we were still downloading a 1000+px image in order to render it at a few hundred px across (and also we don't pay anything for these right now). Happy to change now/in the future if this doesn't seem right though. ### Change type - [x] `api` ### Release notes #### Breaking changes / user facing changes - The copy/export as JSON option has been removed. Data copied/exported from here could not be used anyway. If you need this in your app, look into `Editor.getContentFromCurrentPage`. - `useImageOrVideoAssetUrl` now expects a `width` parameter representing the rendered width of the asset. - `Editor.getSvgElement` and `Editor.getSvgString` will now export all shapes on the current page instead of returning undefined when passed an empty array of shape ids. #### Product improvement - When exporting to an image, image assets are now downloaded at a resolution appropriate for how they will appear in the export. #### API changes - There's a new `Editor.toImage` method that makes creating an image from your canvas easier. (`exportToBlob` is deprecated in favour of it) - `SvgExportContext` now exposes the `scale` and `pixelRatio` options of the current export - `SvgExportContext` now has a `resolveAssetUrl` method to resolve an asset at a resolution appropriate for the export. - `copyAs(editor, ids, format, opts)` has been deprecated in favour of `copyAs(editor, ids, opts)`. - `exportAs(editor, ids, format, name, opts)` has been deprecated in favour of `exportAs(editor, ids, opts)`
Lokalise isn't handling ICU plurals correctly. Their system is restricted to only doing full sentences as plurals, argh. I reported this bug to them and they're looking into it. In the meantime, we need to do this. Also, drive-by to add Release Tag for the automatic PRs ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
This pull request was initiated by Lokalise (user Mime) at 2025-01-21 10:05:11
### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other`
I was finding the _session cookie was not a reliable way to detect signed-in state, so have switched to localStorage. It's not perfect either, but should be a lot more accurate. ### Change type - [x] `other`
switch from sign-in to sign-up for the /preview button ### Change type - [x] `other`
Changes: * We now use the main sync worker for tldraw app asset uploads. For old assets we still continue to use the assets worker. * Image resize worker is now deployed as part of our deploy dotcom action. It receives the multiplayer worker url. If the asset origin is same as the multiplayer url (we are fetching tldraw app asset) it uses a service binding to request the asset. This is to avoid some permissions issues we encountered when the image worker fetched directly from the multiplayer worker. The fetching for existing assets should remain the same. I added `IMAGE_WORKER` env variable to different environments for our github actions. * We now associate assets with files. We do this in two ways: 1. when users upload the files we immediately add the `fileId` to the asset's `meta` property. We then also write an entry into a new postgres table called `asset`. 2. in some cases we do this server side (duplicating a room, copy pasting tldraw content, slurping legacy multiplayer rooms). The way it works is that the server checks all the tldraw app assets and makes sure their meta is associated to the correct file. If it is not it re-uploads the file to the uploads bucket and it updates the asset. It does this when persisting a file and also on restore. * There are some public API changes listed that were necessary to make this work. They are listed below. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes **Breaking change** - `@tldraw/tlschema`: `TLAssetStore.upload` used to return just the `src` of the uploaded asset. It now returns `{src: string, meta?: JsonObject}`. The returned metadata will be added to the asset record and thus allows the users to add some additional data to them when uploading. - `@tldraw/editor`: `Editor.uploadAsset` used to return `Promise<string>` and now returns `Promise<{ src: string; meta?: JsonObject }> `
Steve suggested this as a way to avoid having 'Untitled file's in the navbar and long lists of dates in the sidebar. And heck yeah it feels good. ![Kapture 2025-01-21 at 14 35 41](https://github.com/user-attachments/assets/fbf18c2d-e625-4c1a-a542-16a5724b5b53) TODO: - [ ] add a couple of e2e tests for this. ### Change type - [x] `other`
Looks like these were no longer used. ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other`
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.
See Commits and Changes for more details.
Created by pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )