mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add app state to history (#309)
* Add app state to history. * Pick missing state keys. * Fix bug. * Remove force update.
This commit is contained in:
parent
3f1075cbcd
commit
dfb7c2b744
2 changed files with 34 additions and 9 deletions
|
@ -1,3 +1,4 @@
|
|||
import { AppState } from "./types";
|
||||
import { ExcalidrawElement } from "./element/types";
|
||||
|
||||
class SceneHistory {
|
||||
|
@ -5,13 +6,17 @@ class SceneHistory {
|
|||
private stateHistory: string[] = [];
|
||||
private redoStack: string[] = [];
|
||||
|
||||
generateCurrentEntry(elements: readonly ExcalidrawElement[]) {
|
||||
return JSON.stringify(
|
||||
elements.map(({ shape, ...element }) => ({
|
||||
generateCurrentEntry(
|
||||
appState: Partial<AppState>,
|
||||
elements: readonly ExcalidrawElement[]
|
||||
) {
|
||||
return JSON.stringify({
|
||||
appState,
|
||||
elements: elements.map(({ shape, ...element }) => ({
|
||||
...element,
|
||||
isSelected: false
|
||||
}))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
pushEntry(newEntry: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue