Merge branch 'dev' into dev.loading

This commit is contained in:
Eric NGUYEN 2022-11-04 12:05:37 +01:00
commit 0ac42b3500
41 changed files with 1609 additions and 1241 deletions

View file

@ -17,6 +17,8 @@ export const FAST_BOOT = 0;
/** Disable any call to the API (default = false) */
export const DISABLE_API = false;
export const DEFAULT_LANGUAGE = 'fr';
/**
* Replace the SVG viewer by a canvas
* Better compatibility with Gecko and WebKit engines like Firefox and Safari.
@ -234,8 +236,6 @@ export function GetDefaultContainerProps(type: string,
height: number,
containerConfig: IAvailableContainer): IContainerProperties {
const orientation = containerConfig.Orientation ?? Orientation.Horizontal;
const defaultIsFlex = (orientation === Orientation.Vertical && containerConfig.Height === undefined) ||
(orientation === Orientation.Horizontal && containerConfig.Width === undefined);
return ({
id: `${type}-${typeCount}`,
type,
@ -249,7 +249,7 @@ export function GetDefaultContainerProps(type: string,
width,
height,
isAnchor: containerConfig.IsAnchor ?? false,
isFlex: containerConfig.IsFlex ?? defaultIsFlex,
isFlex: containerConfig.IsFlex ?? false,
positionReference: containerConfig.PositionReference ?? PositionReference.TopLeft,
minWidth: containerConfig.MinWidth ?? 1,
maxWidth: containerConfig.MaxWidth ?? Number.MAX_SAFE_INTEGER,

View file

@ -2,6 +2,7 @@
import { IEditorState } from '../Interfaces/IEditorState';
import { IHistoryState } from '../Interfaces/IHistoryState';
import { IContainerModel } from '../Interfaces/IContainerModel';
import { ISymbolModel } from '../Interfaces/ISymbolModel';
/**
* Revive the Editor state
@ -29,13 +30,14 @@ export function ReviveState(state: IHistoryState): void {
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()) {
symbol.linkedContainers = new Set(symbol.linkedContainers);
}
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 {