From 24b9b34f6569ed671edaf4e9f14622597688d72c Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 17 Jun 2026 14:20:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E6=81=A2=E5=A4=8D=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BB=84=E4=BB=B6=E5=9C=A8=E5=BD=93=E5=89=8D=E8=A7=86?= =?UTF-8?q?=E7=AA=97=E4=B8=AD=E5=9E=82=E7=9B=B4=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixNodePosition 不应要求 style 已存在 top 才计算居中位置,否则从组件面板新增时无法写入视窗居中 top。 --- packages/editor/src/utils/editor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/utils/editor.ts b/packages/editor/src/utils/editor.ts index 3e924fc0..0ed95d59 100644 --- a/packages/editor/src/utils/editor.ts +++ b/packages/editor/src/utils/editor.ts @@ -378,11 +378,11 @@ export const fixNodePosition = (config: MNode, parent: MContainer, stage: StageC const style = { ...(config.style || {}) }; const baseStyle = config.style || {}; - if ('left' in baseStyle && !('right' in baseStyle)) { + if (!('right' in baseStyle)) { style.left = fixNodeLeft(config, parent, stage?.renderer?.contentWindow?.document); } - if ('top' in baseStyle && !('bottom' in baseStyle)) { + if (!('top' in baseStyle) && !('bottom' in baseStyle)) { style.top = getMiddleTop(config, parent, stage); }