fix: copy and paste without selection occurs error (#1135)

* Add optional chaining

* dont allow empty clipboard data

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
Jang Min 2023-03-10 04:41:23 +09:00 committed by GitHub
parent a9f1a6ccc7
commit 80b4f5aedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1802,6 +1802,9 @@ export class TldrawApp extends StateManager<TDSnapshot> {
const jsonString = JSON.stringify({ const jsonString = JSON.stringify({
type: 'tldr/clipboard', type: 'tldr/clipboard',
shapes: [],
assets: [],
bindings: [],
...this.clipboard, ...this.clipboard,
}) })
@ -2183,6 +2186,9 @@ export class TldrawApp extends StateManager<TDSnapshot> {
const tldrawString = JSON.stringify({ const tldrawString = JSON.stringify({
type: 'tldr/clipboard', type: 'tldr/clipboard',
shapes: [],
assets: [],
bindings: [],
...this.clipboard, ...this.clipboard,
}) })