From 663d7cee9ffd55da366b6189661f6f92b8c7a866 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 31 May 2022 21:05:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=BB=98=E8=AE=A4=E6=B7=BB=E5=8A=A0=E5=88=B0=E8=A7=86?= =?UTF-8?q?=E7=AA=97=E4=B8=AD=E9=97=B4=EF=BC=8C=E5=A6=82=E6=9E=9C=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=88=9D=E5=A7=8B=E5=8C=96height=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E6=95=B0=E5=80=BC=EF=BC=8C=E5=88=99=E5=BD=930=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/utils/editor.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/utils/editor.ts b/packages/editor/src/utils/editor.ts index c38ab562..43491fea 100644 --- a/packages/editor/src/utils/editor.ts +++ b/packages/editor/src/utils/editor.ts @@ -142,9 +142,13 @@ export const toRelative = (node: MNode) => { const setTop2Middle = (node: MNode, parentNode: MNode, stage: StageCore) => { const style = node.style || {}; - const height = style.height || 0; + let height = style.height || 0; - if (!stage || typeof style.top !== 'undefined' || !parentNode.style || !isNumber(height)) return style; + if (!stage || typeof style.top !== 'undefined' || !parentNode.style) return style; + + if (!isNumber(height)) { + height = 0; + } const { height: parentHeight } = parentNode.style;