amis-saas-8146 合并应用国际化 feature/app-i18n-8146 分支

Change-Id: I51360874e3ee49f2aa4aa55abed7aadfe16570e6
This commit is contained in:
wangyuzhen01 2023-01-05 10:00:26 +08:00
parent 4e67c09731
commit 34f82a4301
3 changed files with 36 additions and 7 deletions

View File

@ -147,6 +147,15 @@
}
}
}
&-overlay {
position: absolute;
top: 1px;
left: 1px;
width: calc(100% - 4px);
height: calc(100% - 4px);
cursor: pointer;
}
}
&.is-fullscreen {

View File

@ -28,6 +28,10 @@ export interface EditorProps extends PluginEventListener {
$schemaUrl?: string;
schemas?: Array<any>;
theme?: string;
/** 应用语言类型 */
appLocale?: string;
/** 是否开启多语言 */
i18nEnabled?: boolean;
showCustomRenderersPanel?: boolean;
amisDocHost?: string;
superEditorData?: any;
@ -484,12 +488,15 @@ export default class Editor extends Component<EditorProps> {
isMobile,
className,
theme,
appLocale,
data,
iframeUrl,
previewProps,
autoFocus,
isSubEditor
isSubEditor,
amisEnv
} = this.props;
return (
<div
ref={this.mainRef}
@ -522,7 +529,9 @@ export default class Editor extends Component<EditorProps> {
store={this.store}
manager={this.manager}
theme={theme}
appLocale={appLocale}
data={data}
amisEnv={amisEnv}
autoFocus={autoFocus}
toolbarContainer={this.getToolbarContainer}
></Preview>

View File

@ -26,6 +26,8 @@ export interface PreviewProps {
// ) => boolean;
theme?: string;
/** 应用语言类型 */
appLocale?: string;
amisEnv?: any;
className?: string;
editable?: boolean;
@ -60,8 +62,7 @@ export default class Preview extends Component<PreviewProps> {
},
theme: this.props.theme,
session: `preview-${this.props.manager.id}`,
rendererResolver: this.rendererResolver.bind(this),
...this.props.amisEnv
rendererResolver: this.rendererResolver.bind(this)
};
doingSelection = false;
@ -468,9 +469,15 @@ export default class Preview extends Component<PreviewProps> {
iframeUrl,
autoFocus,
toolbarContainer,
appLocale,
...rest
} = this.props;
const env = {
...this.env,
...amisEnv
};
return (
<div
id="editor-preview-body"
@ -511,7 +518,7 @@ export default class Preview extends Component<PreviewProps> {
editable={editable}
isMobile={isMobile}
store={store}
env={this.env}
env={env}
manager={manager}
url={iframeUrl}
theme={theme}
@ -523,9 +530,10 @@ export default class Preview extends Component<PreviewProps> {
editable={editable}
autoFocus={autoFocus}
store={store}
env={this.env}
env={env}
manager={manager}
key="pc"
appLocale={appLocale}
/>
)}
@ -593,6 +601,8 @@ export interface SmartPreviewProps {
env: any;
data?: any;
manager: EditorManager;
/** 应用语言类型 */
appLocale?: string;
}
@observer
class SmartPreview extends React.Component<SmartPreviewProps> {
@ -618,7 +628,7 @@ class SmartPreview extends React.Component<SmartPreviewProps> {
}
render() {
const {editable, store, autoFocus, env, data, manager, ...rest} =
const {editable, store, appLocale, autoFocus, env, data, manager, ...rest} =
this.props;
return render(
@ -627,7 +637,8 @@ class SmartPreview extends React.Component<SmartPreviewProps> {
...rest,
key: editable ? 'edit-mode' : 'preview-mode',
theme: env.theme,
data: data ?? store.ctx
data: data ?? store.ctx,
locale: appLocale
},
env
);