mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Restore on page load
This commit is contained in:
parent
110b8b15ce
commit
9e6db9a31c
1 changed files with 2 additions and 7 deletions
|
@ -370,8 +370,6 @@ function restore() {
|
||||||
item = generateDraw(item);
|
item = generateDraw(item);
|
||||||
}
|
}
|
||||||
elements = [...items];
|
elements = [...items];
|
||||||
|
|
||||||
drawScene();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,8 +461,6 @@ class App extends React.Component<{}, AppState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const hasSavedItems = !!localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="wrappers">
|
<div className="wrappers">
|
||||||
|
@ -472,9 +468,6 @@ class App extends React.Component<{}, AppState> {
|
||||||
<button disabled={elements.length === 0} onClick={save}>
|
<button disabled={elements.length === 0} onClick={save}>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button disabled={!hasSavedItems} onClick={restore}>
|
|
||||||
Restore
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="exportWrapper">
|
<div className="exportWrapper">
|
||||||
<button
|
<button
|
||||||
|
@ -740,6 +733,8 @@ const context = canvas.getContext("2d")!;
|
||||||
// https://stackoverflow.com/questions/13879322/drawing-a-1px-thick-line-in-canvas-creates-a-2px-thick-line/13879402#comment90766599_13879402
|
// https://stackoverflow.com/questions/13879322/drawing-a-1px-thick-line-in-canvas-creates-a-2px-thick-line/13879402#comment90766599_13879402
|
||||||
context.translate(0.5, 0.5);
|
context.translate(0.5, 0.5);
|
||||||
|
|
||||||
|
restore();
|
||||||
|
|
||||||
function drawScene() {
|
function drawScene() {
|
||||||
ReactDOM.render(<App />, rootElement);
|
ReactDOM.render(<App />, rootElement);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue