فهرست منبع

capture history

Ryan Di 1 سال پیش
والد
کامیت
09e249ae57
3فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 1 1
      packages/excalidraw/components/App.tsx
  2. 5 0
      packages/excalidraw/components/Stats/DragInput.tsx
  3. 1 0
      packages/excalidraw/types.ts

+ 1 - 1
packages/excalidraw/components/App.tsx

@@ -546,7 +546,7 @@ class App extends React.Component<AppProps, AppState> {
   public library: AppClassProperties["library"];
   public libraryItemsFromStorage: LibraryItems | undefined;
   public id: string;
-  private store: Store;
+  store: Store;
   private history: History;
   private excalidrawContainerValue: {
     container: HTMLDivElement | null;

+ 5 - 0
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<HTMLInputElement>(null);
   const labelRef = useRef<HTMLDivElement>(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();
             }
           }

+ 1 - 0
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"];