From c1f27597dfe0b8cf4792804779352d08773837c3 Mon Sep 17 00:00:00 2001 From: zhou999 Date: Mon, 16 Jan 2023 14:19:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20amis-saas-8146=20=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8editorStor=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia1c1cbcb88e1b41558a9919c5f16e1be2d67fa44 --- packages/amis-editor/src/plugin/CRUD.tsx | 3 ++- packages/amis-editor/src/plugin/Collapse.tsx | 3 ++- packages/amis-editor/src/plugin/Form/ConditionBuilder.tsx | 3 ++- packages/amis-editor/src/plugin/Form/Form.tsx | 5 ++++- packages/amis-editor/src/plugin/Form/InputNumber.tsx | 3 ++- packages/amis-editor/src/plugin/Form/InputRating.tsx | 3 ++- packages/amis-editor/src/plugin/Form/InputTable.tsx | 3 ++- packages/amis-editor/src/plugin/Table.tsx | 3 ++- 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/amis-editor/src/plugin/CRUD.tsx b/packages/amis-editor/src/plugin/CRUD.tsx index 9a4d89571..ed738e943 100644 --- a/packages/amis-editor/src/plugin/CRUD.tsx +++ b/packages/amis-editor/src/plugin/CRUD.tsx @@ -186,7 +186,8 @@ export class CRUDPlugin extends BasePlugin { }; get scaffoldForm(): ScaffoldForm { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return { title: '增删改查快速开始-CRUD', body: [ diff --git a/packages/amis-editor/src/plugin/Collapse.tsx b/packages/amis-editor/src/plugin/Collapse.tsx index 2e32c7bce..f086e3828 100644 --- a/packages/amis-editor/src/plugin/Collapse.tsx +++ b/packages/amis-editor/src/plugin/Collapse.tsx @@ -36,7 +36,8 @@ export class CollapsePlugin extends BasePlugin { panelJustify = true; panelBodyCreator = (context: BaseEventContext) => { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return getSchemaTpl('tabs', [ { title: '属性', diff --git a/packages/amis-editor/src/plugin/Form/ConditionBuilder.tsx b/packages/amis-editor/src/plugin/Form/ConditionBuilder.tsx index 78f62ef98..1a53779f9 100644 --- a/packages/amis-editor/src/plugin/Form/ConditionBuilder.tsx +++ b/packages/amis-editor/src/plugin/Form/ConditionBuilder.tsx @@ -98,7 +98,8 @@ export class ConditionBilderPlugin extends BasePlugin { }; get scaffoldForm(): ScaffoldForm { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return { title: '快速开始-条件组合', body: [ diff --git a/packages/amis-editor/src/plugin/Form/Form.tsx b/packages/amis-editor/src/plugin/Form/Form.tsx index 4ff9a93b3..7ba3240ed 100644 --- a/packages/amis-editor/src/plugin/Form/Form.tsx +++ b/packages/amis-editor/src/plugin/Form/Form.tsx @@ -165,7 +165,8 @@ export class FormPlugin extends BasePlugin { }; get scaffoldForm(): ScaffoldForm { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return { title: '快速创建表单', body: [ @@ -434,6 +435,8 @@ export class FormPlugin extends BasePlugin { panelBodyCreator = (context: BaseEventContext) => { const isCRUDFilter: boolean = /\/crud\/filter\/form$/.test(context.path); const isInDialog: boolean = /(?:\/|^)dialog\/.+$/.test(context.path); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return [ getSchemaTpl('tabs', [ diff --git a/packages/amis-editor/src/plugin/Form/InputNumber.tsx b/packages/amis-editor/src/plugin/Form/InputNumber.tsx index 98feb882d..c9de896c3 100644 --- a/packages/amis-editor/src/plugin/Form/InputNumber.tsx +++ b/packages/amis-editor/src/plugin/Form/InputNumber.tsx @@ -126,7 +126,8 @@ export class NumberControlPlugin extends BasePlugin { ]; panelBodyCreator = (context: BaseEventContext) => { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return getSchemaTpl('tabs', [ { title: '属性', diff --git a/packages/amis-editor/src/plugin/Form/InputRating.tsx b/packages/amis-editor/src/plugin/Form/InputRating.tsx index 3d14cb217..d5dea6666 100644 --- a/packages/amis-editor/src/plugin/Form/InputRating.tsx +++ b/packages/amis-editor/src/plugin/Form/InputRating.tsx @@ -88,7 +88,8 @@ export class RateControlPlugin extends BasePlugin { panelJustify = true; panelBodyCreator = (context: BaseEventContext) => { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return getSchemaTpl('tabs', [ { title: '属性', diff --git a/packages/amis-editor/src/plugin/Form/InputTable.tsx b/packages/amis-editor/src/plugin/Form/InputTable.tsx index 12edb8781..841c7c37e 100644 --- a/packages/amis-editor/src/plugin/Form/InputTable.tsx +++ b/packages/amis-editor/src/plugin/Form/InputTable.tsx @@ -79,7 +79,8 @@ export class TableControlPlugin extends BasePlugin { }; get scaffoldForm(): ScaffoldForm { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return { title: '快速构建表格', body: [ diff --git a/packages/amis-editor/src/plugin/Table.tsx b/packages/amis-editor/src/plugin/Table.tsx index 2f38ce97e..7600717f5 100644 --- a/packages/amis-editor/src/plugin/Table.tsx +++ b/packages/amis-editor/src/plugin/Table.tsx @@ -83,7 +83,8 @@ export class TablePlugin extends BasePlugin { }; get scaffoldForm(): ScaffoldForm { - const {i18nEnabled} = getEnv((window as any).editorStore); + const editorStore = (window as any)?.editorStore; + const i18nEnabled = editorStore ? editorStore.i18nEnabled : false; return { title: '快速构建表格', body: [