From 7790ff6dfa9e93346a2919458585a22200e7ca22 Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Tue, 18 Oct 2022 15:21:41 +0200 Subject: [PATCH] Fix setting margins causing invalid values --- src/Components/Editor/Actions/ContainerOperations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Editor/Actions/ContainerOperations.ts b/src/Components/Editor/Actions/ContainerOperations.ts index 00b5ba6..3e8525e 100644 --- a/src/Components/Editor/Actions/ContainerOperations.ts +++ b/src/Components/Editor/Actions/ContainerOperations.ts @@ -327,7 +327,7 @@ function AssignProperty(container: ContainerModel, key: string, value: string | function SetMargin(): void { // We need to detect change in order to apply transformation to the width and height // Knowing the current margin is not enough as we dont keep the original width and height - const oldMarginValue: number = (container.properties.margin as any)[key]; + const oldMarginValue: number = (container.properties.margin as any)[key] ?? 0; const diff = Number(value) - oldMarginValue; switch (key) { case 'left':