diff --git a/packages/tldraw/src/hooks/useKeyboardShortcuts.tsx b/packages/tldraw/src/hooks/useKeyboardShortcuts.tsx index e4a3bbab1..88fd174dc 100644 --- a/packages/tldraw/src/hooks/useKeyboardShortcuts.tsx +++ b/packages/tldraw/src/hooks/useKeyboardShortcuts.tsx @@ -23,7 +23,7 @@ export function useKeyboardShortcuts(ref: React.RefObject) { ) useHotkeys( - 'p,2', + 'd,p,2', () => { if (!canHandleEvent()) return app.selectTool(TDShapeType.Draw) diff --git a/packages/tldraw/src/state/TldrawApp.ts b/packages/tldraw/src/state/TldrawApp.ts index 0f447978c..945d7c3e9 100644 --- a/packages/tldraw/src/state/TldrawApp.ts +++ b/packages/tldraw/src/state/TldrawApp.ts @@ -473,6 +473,7 @@ export class TldrawApp extends StateManager { if (this.callbacks.onChangePage) { this.broadcastPageChanges() } + this.callbacks.onPersist?.(this) } private prevSelectedIds = this.selectedIds @@ -506,26 +507,6 @@ export class TldrawApp extends StateManager { const changedShapes: Record = {} const changedBindings: Record = {} - // const visitedIds = new Set() - // const shapesToVisit = this.shapes - - // while (shapesToVisit.length > 0) { - // const shape = shapesToVisit.pop() - // if (!shape) break - // visitedIds.add(shape.id) - // if (this.prevShapes[shape.id] !== shape) { - // changedShapes[shape.id] = shape - - // if (shape.parentId !== this.currentPageId) { - // shapesToVisit.push(this.page.shapes[shape.parentId]) - // } - - // if (shape.children) { - - // } - // } - // } - this.shapes.forEach((shape) => { visited.add(shape.id) if (this.prevShapes[shape.id] !== shape) { @@ -558,7 +539,6 @@ export class TldrawApp extends StateManager { this.justSent = true this.callbacks.onChangePage?.(this, changedShapes, changedBindings) - this.callbacks.onPersist?.(this) this.prevShapes = this.page.shapes this.prevBindings = this.page.bindings }