mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add AppState to export json to fix various import bugs (#358)
* export background, app state * review comments
This commit is contained in:
parent
0e56cd4f56
commit
a3aa57d98b
2 changed files with 20 additions and 11 deletions
|
@ -40,7 +40,7 @@ export const actionChangeExportBackground: Action = {
|
|||
export const actionSaveScene: Action = {
|
||||
name: "saveScene",
|
||||
perform: (elements, appState, value) => {
|
||||
saveAsJSON(elements, appState.name);
|
||||
saveAsJSON(elements, appState);
|
||||
return {};
|
||||
},
|
||||
PanelComponent: ({ updateData }) => (
|
||||
|
@ -56,8 +56,12 @@ export const actionSaveScene: Action = {
|
|||
|
||||
export const actionLoadScene: Action = {
|
||||
name: "loadScene",
|
||||
perform: (elements, appState, loadedElements) => {
|
||||
return { elements: loadedElements };
|
||||
perform: (
|
||||
elements,
|
||||
appState,
|
||||
{ elements: loadedElements, appState: loadedAppState }
|
||||
) => {
|
||||
return { elements: loadedElements, appState: loadedAppState };
|
||||
},
|
||||
PanelComponent: ({ updateData }) => (
|
||||
<ToolIcon
|
||||
|
@ -66,8 +70,8 @@ export const actionLoadScene: Action = {
|
|||
title="Load"
|
||||
aria-label="Load"
|
||||
onClick={() => {
|
||||
loadFromJSON().then(({ elements }) => {
|
||||
updateData(elements);
|
||||
loadFromJSON().then(({ elements, appState }) => {
|
||||
updateData({ elements: elements, appState: appState });
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue