Ver código fonte

Fix copy svg / json when page is empty.

main
Steve Ruiz 4 anos atrás
pai
commit
b1d46c29f6
1 arquivos alterados com 3 adições e 0 exclusões
  1. 3
    0
      packages/tldraw/src/state/TldrawApp.ts

+ 3
- 0
packages/tldraw/src/state/TldrawApp.ts Ver arquivo

1557
    */
1557
    */
1558
   copySvg = (ids = this.selectedIds, pageId = this.currentPageId) => {
1558
   copySvg = (ids = this.selectedIds, pageId = this.currentPageId) => {
1559
     if (ids.length === 0) ids = Object.keys(this.page.shapes)
1559
     if (ids.length === 0) ids = Object.keys(this.page.shapes)
1560
+    if (ids.length === 0) return
1560
 
1561
 
1561
     const shapes = ids.map((id) => this.getShape(id, pageId))
1562
     const shapes = ids.map((id) => this.getShape(id, pageId))
1562
     const commonBounds = Utils.getCommonBounds(shapes.map(TLDR.getRotatedBounds))
1563
     const commonBounds = Utils.getCommonBounds(shapes.map(TLDR.getRotatedBounds))
1643
    */
1644
    */
1644
   copyJson = (ids = this.selectedIds, pageId = this.currentPageId) => {
1645
   copyJson = (ids = this.selectedIds, pageId = this.currentPageId) => {
1645
     if (ids.length === 0) ids = Object.keys(this.page.shapes)
1646
     if (ids.length === 0) ids = Object.keys(this.page.shapes)
1647
+    if (ids.length === 0) return
1648
+
1646
     const shapes = ids.map((id) => this.getShape(id, pageId))
1649
     const shapes = ids.map((id) => this.getShape(id, pageId))
1647
     const json = JSON.stringify(shapes, null, 2)
1650
     const json = JSON.stringify(shapes, null, 2)
1648
     TLDR.copyStringToClipboard(json)
1651
     TLDR.copyStringToClipboard(json)

Carregando…
Cancelar
Salvar