Quellcode durchsuchen

Restore onPersist (#435)

main
Steve Ruiz vor 3 Jahren
Ursprung
Commit
0039dd2e66
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 1
- 1
packages/tldraw/src/hooks/useKeyboardShortcuts.tsx Datei anzeigen

@@ -23,7 +23,7 @@ export function useKeyboardShortcuts(ref: React.RefObject<HTMLDivElement>) {
23 23
   )
24 24
 
25 25
   useHotkeys(
26
-    'p,2',
26
+    'd,p,2',
27 27
     () => {
28 28
       if (!canHandleEvent()) return
29 29
       app.selectTool(TDShapeType.Draw)

+ 1
- 21
packages/tldraw/src/state/TldrawApp.ts Datei anzeigen

@@ -473,6 +473,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
473 473
     if (this.callbacks.onChangePage) {
474 474
       this.broadcastPageChanges()
475 475
     }
476
+    this.callbacks.onPersist?.(this)
476 477
   }
477 478
 
478 479
   private prevSelectedIds = this.selectedIds
@@ -506,26 +507,6 @@ export class TldrawApp extends StateManager<TDSnapshot> {
506 507
     const changedShapes: Record<string, TDShape | undefined> = {}
507 508
     const changedBindings: Record<string, TDBinding | undefined> = {}
508 509
 
509
-    // const visitedIds = new Set<string>()
510
-    // const shapesToVisit = this.shapes
511
-
512
-    // while (shapesToVisit.length > 0) {
513
-    //   const shape = shapesToVisit.pop()
514
-    //   if (!shape) break
515
-    //   visitedIds.add(shape.id)
516
-    //   if (this.prevShapes[shape.id] !== shape) {
517
-    //     changedShapes[shape.id] = shape
518
-
519
-    //     if (shape.parentId !== this.currentPageId) {
520
-    //       shapesToVisit.push(this.page.shapes[shape.parentId])
521
-    //     }
522
-
523
-    //     if (shape.children) {
524
-
525
-    //     }
526
-    //   }
527
-    // }
528
-
529 510
     this.shapes.forEach((shape) => {
530 511
       visited.add(shape.id)
531 512
       if (this.prevShapes[shape.id] !== shape) {
@@ -558,7 +539,6 @@ export class TldrawApp extends StateManager<TDSnapshot> {
558 539
 
559 540
     this.justSent = true
560 541
     this.callbacks.onChangePage?.(this, changedShapes, changedBindings)
561
-    this.callbacks.onPersist?.(this)
562 542
     this.prevShapes = this.page.shapes
563 543
     this.prevBindings = this.page.bindings
564 544
   }

Laden…
Abbrechen
Speichern