mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
add history.shouldCreateEntry resolver (#1622)
This commit is contained in:
parent
22f7945c70
commit
d2ae18995c
11 changed files with 1349 additions and 3449 deletions
|
@ -3,7 +3,7 @@ import React from "react";
|
|||
import { undo, redo } from "../components/icons";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { t } from "../i18n";
|
||||
import { SceneHistory } from "../history";
|
||||
import { SceneHistory, HistoryEntry } from "../history";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { AppState } from "../types";
|
||||
import { KEYS } from "../keys";
|
||||
|
@ -13,10 +13,7 @@ import { newElementWith } from "../element/mutateElement";
|
|||
const writeData = (
|
||||
prevElements: readonly ExcalidrawElement[],
|
||||
appState: AppState,
|
||||
updater: () => {
|
||||
elements: ExcalidrawElement[];
|
||||
appState: AppState;
|
||||
} | null,
|
||||
updater: () => HistoryEntry | null,
|
||||
): ActionResult => {
|
||||
const commitToHistory = false;
|
||||
if (
|
||||
|
@ -52,6 +49,7 @@ const writeData = (
|
|||
),
|
||||
appState: { ...appState, ...data.appState },
|
||||
commitToHistory,
|
||||
syncHistory: true,
|
||||
};
|
||||
}
|
||||
return { commitToHistory };
|
||||
|
|
|
@ -6,6 +6,7 @@ export type ActionResult = {
|
|||
elements?: readonly ExcalidrawElement[] | null;
|
||||
appState?: AppState | null;
|
||||
commitToHistory: boolean;
|
||||
syncHistory?: boolean;
|
||||
};
|
||||
|
||||
type ActionFn = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue