feat: 接入乐高组件面板

This commit is contained in:
wuyue.xht 2020-04-21 21:55:30 +08:00
parent 567281fa9b
commit e40b1f3e7d
2 changed files with 21 additions and 2 deletions

View File

@ -1,10 +1,12 @@
// @ts-ignore
import Engine from '@ali/visualengine';
import Engine, { Panes } from '@ali/visualengine';
import getTrunkPane from '@ali/ve-trunk-pane';
import loadUrls from './loader';
import { upgradeAssetsBundle } from './upgrade-assets';
const { editor } = Engine;
initTrunkPane();
Engine.init();
load();
@ -52,3 +54,19 @@ async function loadSchema() {
const schema = await editor.utils.get('./schema.json');
editor.set('schema', schema);
}
async function initTrunkPane() {
const assets = await editor.onceGot('legao-assets');
const config = {
disableLowCodeComponent: true,
disableComponentStore: true,
app: {
getAssetsData() {
return assets;
// return data;
},
},
};
const TrunkPane = getTrunkPane(config);
Panes.add(TrunkPane);
}

View File

@ -18,6 +18,7 @@ import PanelDock from './panel-dock';
import Dock from './dock';
import { Stage, StageConfig } from './stage';
import { isValidElement } from 'react';
import { isPlainObject } from 'globals/src/utils';
export enum SkeletonEvents {
PANEL_DOCK_ACTIVE = 'skeleton.panel-dock.active',
@ -230,7 +231,7 @@ export class Skeleton {
add(config: IWidgetBaseConfig & { area: string }) {
const { content, ...restConfig } = config;
if (content) {
if (typeof content === 'object' && !isValidElement(content)) {
if (isPlainObject(content) && !isValidElement(content)) {
Object.keys(content).forEach((key) => {
if (/props$/i.test(key) && restConfig[key]) {
restConfig[key] = {