amis-saas-8146 1. 更改 i18nEnabled 的获取方式

Change-Id: Ie1c65b3e42054abf3522cd5101513288cc82507d
This commit is contained in:
wangyuzhen01 2023-01-17 17:56:53 +08:00
parent 7e217688a6
commit 2cc849e55c
3 changed files with 14 additions and 3 deletions

View File

@ -141,7 +141,8 @@ export default class Editor extends Component<EditorProps> {
ctx: props.ctx,
superEditorData,
appLocale: props.appLocale,
appCorpusData: props?.amisEnv?.replaceText
appCorpusData: props?.amisEnv?.replaceText,
i18nEnabled: props?.i18nEnabled ?? false
},
config
);

View File

@ -202,6 +202,8 @@ export const MainStore = types
targetNames: types.optional(types.array(types.frozen<TargetName>()), []),
ctx: types.frozen(),
/** 是否开启应用多语言 */
i18nEnabled: types.optional(types.boolean, false),
/** 应用语言 */
appLocale: types.optional(types.string, 'zh-CN'),
/** 应用语料 */

View File

@ -1030,6 +1030,11 @@ export function needDefaultWidth(elemType: string) {
return false;
}
/** 是否开启应用国际化 */
export function getI18nEnabled() {
return (window as any)?.editorStore?.i18nEnabled ?? false;
}
/** schema 翻译方法 */
export function translateSchema(schema: any, replaceData?: any) {
replaceData = replaceData || (window as any)?.editorStore?.appCorpusData;
@ -1050,7 +1055,10 @@ export function needFillPlaceholder(curProps: any) {
return false;
}
// 识别page中的aside、body
if (curProps.rendererName === 'page' && (curProps.name === 'aside' || curProps.name === 'body')) {
if (
curProps.rendererName === 'page' &&
(curProps.name === 'aside' || curProps.name === 'body')
) {
return true;
}
// 识别自由容器
@ -1060,7 +1068,7 @@ export function needFillPlaceholder(curProps: any) {
// 支持在plugin中配置
if (curProps.$$editor?.needFillPlaceholder) {
needFillPlaceholder = true;
} else if (curProps.regionConfig?.needFillPlaceholder ) {
} else if (curProps.regionConfig?.needFillPlaceholder) {
needFillPlaceholder = true;
}
return needFillPlaceholder;