From dbc363828c0872ea6beb2db101b5d0a7351ffb9f Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Thu, 23 Jun 2022 17:24:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20flex=E5=B8=83=E5=B1=80=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E5=A2=9E=E5=8A=A0=E5=AE=9A=E4=BD=8D=E3=80=81inset?= =?UTF-8?q?=E3=80=81z-index=E7=AD=89=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0b55c40344cdee00b6c076625f5db2f910f30191 --- packages/amis-editor-core/src/manager.ts | 14 ++++++++++++++ packages/amis-editor-core/src/store/editor.ts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/amis-editor-core/src/manager.ts b/packages/amis-editor-core/src/manager.ts index 18e2267ff..5656af31b 100644 --- a/packages/amis-editor-core/src/manager.ts +++ b/packages/amis-editor-core/src/manager.ts @@ -959,6 +959,20 @@ export class EditorManager { } } + /** + * 判断当前元素是否为flex布局子容器 + * 备注: 以便额外增加布局相关配置项 + */ + isFlexItem(id: string) { + const store = this.store; + const activeId = id || store.activeId; + const parentSchema = store.getSchemaParentById(activeId); + if (parentSchema?.type === 'flex') { + return true; + } + return false; + } + /** * 入口在 Preview 里面,用来获取渲染器对应的编辑器信息。 * 拿到这些信息后会在渲染原本渲染器的地方包一层,并创建高亮框在点选或者 hover 的时候显示。 diff --git a/packages/amis-editor-core/src/store/editor.ts b/packages/amis-editor-core/src/store/editor.ts index 670a7527a..3cdcf9f9b 100644 --- a/packages/amis-editor-core/src/store/editor.ts +++ b/packages/amis-editor-core/src/store/editor.ts @@ -366,7 +366,7 @@ export const EditorStore = types getSchemaParentById(id: string) { return JSONGetParentById(self.schema, id); }, - + getSchemaPath(id: string): string { const paths = JSONGetPathById(self.schema, id); return Array.isArray(paths) ? paths.join('/') : '';