From bf0856687d29505590e372e300df460ccc06cd4f Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Tue, 5 Jul 2022 16:06:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(layout):=20=E5=88=97=E7=BA=A7=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E5=A2=9E=E5=8A=A0=E5=B7=A6=E5=8F=B3=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E5=8A=9F=E8=83=BDicon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8f96f44685ebc750e92cdf1c5428b9fcad8c7397 --- packages/amis-editor-core/scss/editor.scss | 3 ++- packages/amis-editor-core/src/manager.ts | 3 +++ packages/amis-editor-core/src/store/editor.ts | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/amis-editor-core/scss/editor.scss b/packages/amis-editor-core/scss/editor.scss index e58b5fef5..58dd46f12 100644 --- a/packages/amis-editor-core/scss/editor.scss +++ b/packages/amis-editor-core/scss/editor.scss @@ -588,7 +588,8 @@ height: 20px; line-height: 20px; border-radius: 20px; - top: 20%; + top: 50%; + transform: translate(0, -50%); > span > svg { width: 12px; diff --git a/packages/amis-editor-core/src/manager.ts b/packages/amis-editor-core/src/manager.ts index 0c2103f7d..ff212b115 100644 --- a/packages/amis-editor-core/src/manager.ts +++ b/packages/amis-editor-core/src/manager.ts @@ -869,6 +869,9 @@ export class EditorManager { if (!regionNode.region && regionNode.schema.body) { // 默认插入到父节点的body中 regionNodeRegion = 'body'; + } else if (!regionNode.region && regionNode.schema?.type === 'flex' && regionNode.schema.items) { + // flex布局容器 + regionNodeRegion = 'items'; } else if (!regionNode.region && !regionNode.schema.body) { // 其他特殊情况暂时不考虑,给予提示 toast.warning('当前节点不允许追加新组件。'); diff --git a/packages/amis-editor-core/src/store/editor.ts b/packages/amis-editor-core/src/store/editor.ts index bc69ce415..b428e2931 100644 --- a/packages/amis-editor-core/src/store/editor.ts +++ b/packages/amis-editor-core/src/store/editor.ts @@ -852,6 +852,7 @@ export const EditorStore = types return idx < self.schemaHistory.length - 1; }, + // 判断是否时布局容器中的列级元素 isFlexItem(id: string) { const activeId = id || self.activeId; const parentSchema = this.getSchemaParentById(activeId, true);