From 09e249ae574dfa6e3e888b3c33ff1e3bc4d7e7ef Mon Sep 17 00:00:00 2001 From: Ryan Di Date: Tue, 4 Jun 2024 16:27:53 +0800 Subject: [PATCH] capture history --- packages/excalidraw/components/App.tsx | 2 +- packages/excalidraw/components/Stats/DragInput.tsx | 5 +++++ packages/excalidraw/types.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index c319f4c44..e82d8759e 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -546,7 +546,7 @@ class App extends React.Component { public library: AppClassProperties["library"]; public libraryItemsFromStorage: LibraryItems | undefined; public id: string; - private store: Store; + store: Store; private history: History; private excalidrawContainerValue: { container: HTMLDivElement | null; diff --git a/packages/excalidraw/components/Stats/DragInput.tsx b/packages/excalidraw/components/Stats/DragInput.tsx index 9f13d2019..a56d6dbfe 100644 --- a/packages/excalidraw/components/Stats/DragInput.tsx +++ b/packages/excalidraw/components/Stats/DragInput.tsx @@ -7,6 +7,7 @@ import { deepCopyElement } from "../../element/newElement"; import "./DragInput.scss"; import clsx from "clsx"; +import { useApp } from "../App"; export type DragInputCallbackType = ( accumulatedChange: number, @@ -34,6 +35,7 @@ const StatsDragInput = ({ editable = true, shouldKeepAspectRatio, }: StatsDragInputProps) => { + const app = useApp(); const inputRef = useRef(null); const labelRef = useRef(null); @@ -110,6 +112,8 @@ const StatsDragInput = ({ false, ); + app.store.shouldCaptureIncrement(); + lastPointer = null; accumulatedChange = null; stateAtStart = null; @@ -153,6 +157,7 @@ const StatsDragInput = ({ false, v, ); + app.store.shouldCaptureIncrement(); eventTarget.blur(); } } diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts index a9cc47d97..a72dbfccf 100644 --- a/packages/excalidraw/types.ts +++ b/packages/excalidraw/types.ts @@ -592,6 +592,7 @@ export type AppClassProperties = { files: BinaryFiles; device: App["device"]; scene: App["scene"]; + store: App["store"]; pasteFromClipboard: App["pasteFromClipboard"]; id: App["id"]; onInsertElements: App["onInsertElements"];