mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
feat: 新增simulatorurl,可以设置cdn使用simulator
This commit is contained in:
parent
0ee8892190
commit
1f45b05028
@ -120,6 +120,12 @@ export default {
|
||||
init: async function init(editor) {
|
||||
const assets = await editor.utils.get('./assets.json');
|
||||
editor.set('assets', assets);
|
||||
const simulatorUrl = [
|
||||
'https://dev.g.alicdn.com/ali-lowcode/ali-lowcode-engine/0.9.50/react-simulator-renderer.css',
|
||||
'https://dev.g.alicdn.com/ali-lowcode/ali-lowcode-engine/0.9.50/react-simulator-renderer.js',
|
||||
];
|
||||
editor.set('simulatorUrl', simulatorUrl);
|
||||
// editor.set('renderEnv', 'rax');
|
||||
|
||||
const schema = await editor.utils.get('./schema.json');
|
||||
editor.set('schema', schema);
|
||||
|
||||
@ -225,7 +225,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
const vendors = [
|
||||
// required & use once
|
||||
assetBundle(
|
||||
this.get('environment') || this.renderEnv === 'rax' ? defaultRaxEnvironment : defaultEnvironment,
|
||||
this.get('environment') || (this.renderEnv === 'rax' ? defaultRaxEnvironment : defaultEnvironment),
|
||||
AssetLevel.Environment,
|
||||
),
|
||||
// required & use once
|
||||
@ -236,7 +236,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
assetBundle(this.theme, AssetLevel.Theme),
|
||||
// required & use once
|
||||
assetBundle(
|
||||
this.get('simulatorUrl') || this.renderEnv === 'rax' ? defaultRaxSimulatorUrl : defaultSimulatorUrl,
|
||||
this.get('simulatorUrl') || (this.renderEnv === 'rax' ? defaultRaxSimulatorUrl : defaultSimulatorUrl),
|
||||
AssetLevel.Runtime,
|
||||
),
|
||||
];
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Editor } from '@ali/lowcode-editor-core';
|
||||
import { DesignerView, Designer } from '@ali/lowcode-designer';
|
||||
import { Asset } from '@ali/lowcode-utils';
|
||||
import './index.scss';
|
||||
|
||||
export interface PluginProps {
|
||||
@ -13,6 +14,7 @@ interface DesignerPluginState {
|
||||
extraEnvironment?: any[] | null;
|
||||
renderEnv?: string;
|
||||
device?: string;
|
||||
simulatorUrl: Asset | null;
|
||||
}
|
||||
|
||||
export default class DesignerPlugin extends PureComponent<PluginProps, DesignerPluginState> {
|
||||
@ -24,6 +26,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
extraEnvironment: null,
|
||||
renderEnv: 'default',
|
||||
device: 'default',
|
||||
simulatorUrl: null,
|
||||
};
|
||||
|
||||
private _mounted = true;
|
||||
@ -39,6 +42,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
const assets = await editor.onceGot('assets');
|
||||
const renderEnv = await editor.get('renderEnv');
|
||||
const device = await editor.get('device');
|
||||
const simulatorUrl = await editor.get('simulatorUrl');
|
||||
if (!this._mounted) {
|
||||
return;
|
||||
}
|
||||
@ -49,6 +53,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
extraEnvironment,
|
||||
renderEnv,
|
||||
device,
|
||||
simulatorUrl,
|
||||
};
|
||||
this.setState(state);
|
||||
} catch (e) {
|
||||
@ -71,8 +76,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
|
||||
render(): React.ReactNode {
|
||||
const { editor } = this.props;
|
||||
const { componentMetadatas, library, extraEnvironment, renderEnv, device } = this.state;
|
||||
|
||||
const { componentMetadatas, library, extraEnvironment, renderEnv, device, simulatorUrl } = this.state;
|
||||
if (!library || !componentMetadatas) {
|
||||
// TODO: use a Loading
|
||||
return null;
|
||||
@ -90,6 +94,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
extraEnvironment,
|
||||
renderEnv,
|
||||
device,
|
||||
simulatorUrl,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -55,5 +55,5 @@
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npm.alibaba-inc.com"
|
||||
},
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@1.0.4-0/build/index.html"
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@1.0.5-0/build/index.html"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user