mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
This reverts commit db973c61e8
.
This commit is contained in:
parent
829a65b8cb
commit
ae982e9298
3 changed files with 3 additions and 40 deletions
|
@ -18,8 +18,6 @@ import {
|
|||
exportAsPNG,
|
||||
restoreFromLocalStorage,
|
||||
saveToLocalStorage,
|
||||
restoreFromURL,
|
||||
saveToURL,
|
||||
hasBackground,
|
||||
hasStroke,
|
||||
getElementAtPosition,
|
||||
|
@ -122,8 +120,7 @@ class App extends React.Component<{}, AppState> {
|
|||
document.addEventListener("keydown", this.onKeyDown, false);
|
||||
window.addEventListener("resize", this.onResize, false);
|
||||
|
||||
const savedState =
|
||||
restoreFromURL(elements) || restoreFromLocalStorage(elements);
|
||||
const savedState = restoreFromLocalStorage(elements);
|
||||
if (savedState) {
|
||||
this.setState(savedState);
|
||||
}
|
||||
|
@ -951,11 +948,6 @@ class App extends React.Component<{}, AppState> {
|
|||
}));
|
||||
};
|
||||
|
||||
private saveDebounced = debounce(() => {
|
||||
saveToLocalStorage(elements, this.state);
|
||||
saveToURL(elements, this.state);
|
||||
}, 300);
|
||||
|
||||
private addElementsFromPaste = (paste: string, x?: number, y?: number) => {
|
||||
let parsedElements;
|
||||
try {
|
||||
|
@ -995,7 +987,7 @@ class App extends React.Component<{}, AppState> {
|
|||
scrollY: this.state.scrollY,
|
||||
viewBackgroundColor: this.state.viewBackgroundColor
|
||||
});
|
||||
this.saveDebounced();
|
||||
saveToLocalStorage(elements, this.state);
|
||||
if (history.isRecording()) {
|
||||
history.pushEntry(history.generateCurrentEntry(elements));
|
||||
history.clearRedoStack();
|
||||
|
@ -1004,14 +996,6 @@ class App extends React.Component<{}, AppState> {
|
|||
}
|
||||
}
|
||||
|
||||
function debounce<T extends any[]>(fn: (...args: T) => void, timeout: number) {
|
||||
let handle = 0;
|
||||
return (...args: T) => {
|
||||
clearTimeout(handle);
|
||||
handle = window.setTimeout(() => fn(...args), timeout);
|
||||
};
|
||||
}
|
||||
|
||||
const rootElement = document.getElementById("root");
|
||||
ReactDOM.render(<App />, rootElement);
|
||||
const canvas = document.getElementById("canvas") as HTMLCanvasElement;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue