From 6f45e07feefd5855a9583291189ca647a43f1e92 Mon Sep 17 00:00:00 2001 From: Siklos Date: Thu, 4 Aug 2022 19:55:42 +0200 Subject: [PATCH] Fix: Container not updating when changing their attribute --- src/Editor.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Editor.tsx b/src/Editor.tsx index 0920586..8b4edb6 100644 --- a/src/Editor.tsx +++ b/src/Editor.tsx @@ -138,8 +138,7 @@ class Editor extends React.Component { } const mainContainerClone: IContainerModel = structuredClone(current.MainContainer); - const it = MakeIterator(mainContainerClone); - const container: ContainerModel | undefined = findContainerById(current.MainContainer, current.SelectedContainer.properties.id); + const container: ContainerModel | undefined = findContainerById(mainContainerClone, current.SelectedContainer.properties.id); if (container === null || container === undefined) { throw new Error('[OnPropertyChange] Container model was not found among children of the main container!'); @@ -254,7 +253,9 @@ class Editor extends React.Component { public SaveEditor() { const exportName = 'state'; - const dataStr = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(this.state, getCircularReplacer(), 4))}`; + const spaces = import.meta.env.DEV ? 4 : 0; + const data = JSON.stringify(this.state, getCircularReplacer(), spaces); + const dataStr = `data:text/json;charset=utf-8,${encodeURIComponent(data)}`; const downloadAnchorNode = document.createElement('a'); downloadAnchorNode.setAttribute('href', dataStr); downloadAnchorNode.setAttribute('download', `${exportName}.json`);