From 3b30d89956717d686046876156c3571f35c0036f Mon Sep 17 00:00:00 2001 From: roymondchen Date: Fri, 30 Dec 2022 16:33:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E6=96=B0=E5=A2=9E=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96left=E5=80=BC,=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=80=9A=E8=BF=87=E9=94=AE=E7=9B=98=E6=96=B9?= =?UTF-8?q?=E5=90=91=E9=94=AE=E5=B7=A6=E5=8F=B3=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #468 --- packages/editor/src/utils/editor.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/utils/editor.ts b/packages/editor/src/utils/editor.ts index 99016aa1..d91125b3 100644 --- a/packages/editor/src/utils/editor.ts +++ b/packages/editor/src/utils/editor.ts @@ -110,10 +110,16 @@ const getMiddleTop = (node: MNode, parentNode: MNode, stage: StageCore | null) = export const getInitPositionStyle = (style: Record = {}, layout: Layout) => { if (layout === Layout.ABSOLUTE) { - return { + const newStyle: Record = { ...style, position: 'absolute', }; + + if (typeof newStyle.left === 'undefined' && typeof newStyle.right === 'undefined') { + newStyle.left = 0; + } + + return newStyle; } if (layout === Layout.RELATIVE) {