소스 검색

Fix copy svg / json when page is empty.

main
Steve Ruiz 3 년 전
부모
커밋
b1d46c29f6
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3
    0
      packages/tldraw/src/state/TldrawApp.ts

+ 3
- 0
packages/tldraw/src/state/TldrawApp.ts 파일 보기

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

Loading…
취소
저장