Fix Symbols serialization like the containers
This commit is contained in:
parent
b44c6fb477
commit
afffaa0595
1 changed files with 4 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
import { IEditorState } from '../Interfaces/IEditorState';
|
import { IEditorState } from '../Interfaces/IEditorState';
|
||||||
import { IHistoryState } from '../Interfaces/IHistoryState';
|
import { IHistoryState } from '../Interfaces/IHistoryState';
|
||||||
import { IContainerModel } from '../Interfaces/IContainerModel';
|
import { IContainerModel } from '../Interfaces/IContainerModel';
|
||||||
|
import { ISymbolModel } from '../Interfaces/ISymbolModel';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revive the Editor state
|
* Revive the Editor state
|
||||||
|
@ -29,13 +30,14 @@ export function ReviveState(state: IHistoryState): void {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.symbols = new Map(state.symbols);
|
const symbols: Array<{ Key: string, Value: ISymbolModel }> = (state.symbols) as any;
|
||||||
|
state.symbols = new Map(symbols.map(({ Key, Value }) => [Key, Value]));
|
||||||
for (const symbol of state.symbols.values()) {
|
for (const symbol of state.symbols.values()) {
|
||||||
symbol.linkedContainers = new Set(symbol.linkedContainers);
|
symbol.linkedContainers = new Set(symbol.linkedContainers);
|
||||||
}
|
}
|
||||||
|
|
||||||
const containers: Array<{ Key: string, Value: IContainerModel }> = (state.containers) as any;
|
const containers: Array<{ Key: string, Value: IContainerModel }> = (state.containers) as any;
|
||||||
state.containers = new Map(containers.map(({ Key, Value }: {Key: string, Value: IContainerModel}) => [Key, Value]));
|
state.containers = new Map(containers.map(({ Key, Value }) => [Key, Value]));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetCircularReplacer(): (key: any, value: object | Map<string, any> | null) => object | null | undefined {
|
export function GetCircularReplacer(): (key: any, value: object | Map<string, any> | null) => object | null | undefined {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue