mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
parent
57ad94a136
commit
4aed7004ca
@ -19,10 +19,21 @@ function filterUrl(url: string) {
|
||||
}
|
||||
|
||||
function onLoad(req: any, callback: (result: any) => void) {
|
||||
const locale =
|
||||
((window as any).__amis_monaco_editor_locale &&
|
||||
(
|
||||
{
|
||||
'zh-CN': 'zh-cn',
|
||||
'en-US': '',
|
||||
'de-DE': 'de'
|
||||
} as any
|
||||
)[(window as any).__amis_monaco_editor_locale]) ||
|
||||
'';
|
||||
|
||||
const config = {
|
||||
'vs/nls': {
|
||||
availableLanguages: {
|
||||
'*': 'zh-cn'
|
||||
'*': locale
|
||||
}
|
||||
},
|
||||
'paths': {
|
||||
|
@ -201,6 +201,9 @@ export class Editor extends React.Component<EditorProps, EditorState> {
|
||||
}
|
||||
|
||||
loadMonaco() {
|
||||
// 由于 require.config({'vs/nls': { availableLanguages: { '*': 'xxxx' }}}) 只能在初始化之前设置有用,所以这里只能用全局变量的方式来设置。
|
||||
// 另外此方式只是针对 jssdk 和平台有效,对于其他方式还需要再想想。
|
||||
(window as any).__amis_monaco_editor_locale = this.props.locale;
|
||||
import('monaco-editor').then(monaco => this.initMonaco(monaco));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user