Merge pull request 'Fix: Container not updating when changing their attribute' (#9) from dev into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/9
This commit is contained in:
commit
6d1279f1ef
1 changed files with 4 additions and 3 deletions
|
@ -138,8 +138,7 @@ class Editor extends React.Component<IEditorProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mainContainerClone: IContainerModel = structuredClone(current.MainContainer);
|
const mainContainerClone: IContainerModel = structuredClone(current.MainContainer);
|
||||||
const it = MakeIterator(mainContainerClone);
|
const container: ContainerModel | undefined = findContainerById(mainContainerClone, current.SelectedContainer.properties.id);
|
||||||
const container: ContainerModel | undefined = findContainerById(current.MainContainer, current.SelectedContainer.properties.id);
|
|
||||||
|
|
||||||
if (container === null || container === undefined) {
|
if (container === null || container === undefined) {
|
||||||
throw new Error('[OnPropertyChange] Container model was not found among children of the main container!');
|
throw new Error('[OnPropertyChange] Container model was not found among children of the main container!');
|
||||||
|
@ -254,7 +253,9 @@ class Editor extends React.Component<IEditorProps> {
|
||||||
|
|
||||||
public SaveEditor() {
|
public SaveEditor() {
|
||||||
const exportName = 'state';
|
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');
|
const downloadAnchorNode = document.createElement('a');
|
||||||
downloadAnchorNode.setAttribute('href', dataStr);
|
downloadAnchorNode.setAttribute('href', dataStr);
|
||||||
downloadAnchorNode.setAttribute('download', `${exportName}.json`);
|
downloadAnchorNode.setAttribute('download', `${exportName}.json`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue