mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-06-30 21:18:14 +08:00
fix(editor): 恢复新增组件在当前视窗中垂直居中
fixNodePosition 不应要求 style 已存在 top 才计算居中位置,否则从组件面板新增时无法写入视窗居中 top。
This commit is contained in:
parent
95769d6ae0
commit
24b9b34f65
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user