tldraw/apps/examples/e2e/tests
alex 25328f98d0
refactor copy/export, fix safari copy-as-image being broken (#2411)
In #2198, we introduced a regression on ios around image exports. ios
will block copys if they're not called syncronously in a UI event. It's
important to make ios copys like this:
```ts
navigator.clipboard.write(new ClipboardItem(getStuffToCopyAsAPromise())
```

instead of
```ts
getStuffToCopyAsAPromise().then(stuff => {
    navigator.clipboard.write(new ClipboardItem(stuff))
})
```

We've written and fixed this bug a few times, which i think is because
of how our export/copy code is written: the formatting is interspersed
with interacting with the browser APIs, which makes it hard to change
one without accidentally affecting the other.

This diff fixes the bug, but also restructures our export/copy code: all
the formatting is handled by `exportToBlob` and related which just
return `Blob`s. This leaves `copyAs`, `exportAs` etc. to just handle
interacting with the browser APIs.

Fixes #2312

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Test copy/export as on all browsers

### Release Notes

- Fix a bug preventing copying as an image on iOS

---------

Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
2024-01-09 14:50:10 +00:00
..
export-snapshots.spec.ts-snapshots refactor copy/export, fix safari copy-as-image being broken (#2411) 2024-01-09 14:50:10 +00:00
test-canvas-events.spec.ts-snapshots Replace Atom.value with Atom.get() (#2189) 2023-11-13 11:51:22 +00:00
export-snapshots.spec.ts fix export snapshot race condition (#2280) 2023-12-04 13:52:37 +00:00
test-camera.spec.ts Add playwright tests (#1484) 2023-05-30 15:28:56 +01:00
test-canvas-events.spec.ts Remove focus management (#1953) 2023-10-02 11:29:54 +00:00
test-clipboard.spec.ts No impure getters pt8 (#2221) 2023-11-14 16:32:27 +00:00
test-focus.spec.ts No impure getters pt8 (#2221) 2023-11-14 16:32:27 +00:00
test-kbds.spec.ts [improvement] quick actions (#1922) 2023-09-19 15:33:39 +00:00
test-routes.spec.ts Add snapshot prop, examples (#1856) 2023-09-08 14:48:55 +00:00
test-shapes.spec.ts Tighten up editor ui (#2102) 2023-10-28 21:58:32 +00:00
test-smoke.spec.ts No impure getters pt3 (#2203) 2023-11-13 14:31:27 +00:00
test-text.spec.ts [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
test-ui.spec.ts Only upload playwright to S3 if we have the right credentials (#2074) 2023-10-13 13:42:41 +00:00