chore: 使用新的 engine-core

This commit is contained in:
lihao.ylh 2021-12-23 11:20:07 +08:00
parent a52fcafc45
commit 23c08b2108

View File

@ -6,30 +6,43 @@ import {
Designer, Designer,
LowCodePluginManager, LowCodePluginManager,
ILowCodePluginContext, ILowCodePluginContext,
Setters, // Setters,
} from '@ali/lowcode-designer'; } from '@ali/lowcode-designer';
import * as designerCabin from '@ali/lowcode-designer'; import * as designerCabin from '@ali/lowcode-designer';
import { Skeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-editor-skeleton'; import { Skeleton as InnerSkeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-editor-skeleton';
import * as skeletonCabin from '@ali/lowcode-editor-skeleton'; import * as skeletonCabin from '@ali/lowcode-editor-skeleton';
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane'; import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
import DesignerPlugin from '@ali/lowcode-plugin-designer'; import DesignerPlugin from '@ali/lowcode-plugin-designer';
import {
Hotkey,
Project,
Skeleton,
Setters,
Material,
Event,
editorSymbol,
designerSymbol,
skeletonSymbol,
} from '@ali/lowcode-shell';
import { getLogger, Logger } from '@ali/lowcode-utils';
import './modules/live-editing'; import './modules/live-editing';
import { isPlainObject } from '@ali/lowcode-utils'; import { isPlainObject } from '@ali/lowcode-utils';
import utils from './modules/utils'; import utils from './modules/utils';
export * from './modules/editor-types'; export * from './modules/editor-types';
export * from './modules/skeleton-types'; export * from './modules/skeleton-types';
export * from './modules/designer-types'; export * from './modules/designer-types';
export * from './modules/lowcode-types'; export * from './modules/lowcode-types';
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin; const { monitor } = editorCabin;
registerDefaults(); registerDefaults();
const editor = new Editor(); const editor = new Editor();
globalContext.register(editor, Editor); globalContext.register(editor, Editor);
globalContext.register(editor, 'editor'); globalContext.register(editor, 'editor');
const skeleton = new Skeleton(editor); const skeleton = new InnerSkeleton(editor);
editor.set(Skeleton, skeleton); editor.set(Skeleton, skeleton);
editor.set('skeleton' as any, skeleton); editor.set('skeleton' as any, skeleton);
@ -42,11 +55,20 @@ editor.set('plugins' as any, plugins);
const { project, currentSelection: selection } = designer; const { project, currentSelection: selection } = designer;
const { Workbench } = skeletonCabin; const { Workbench } = skeletonCabin;
const setters: Setters = { // const setters: Setters = {
getSetter, // getSetter,
registerSetter, // registerSetter,
getSettersMap, // getSettersMap,
}; // };
const hotkey = new Hotkey();
const project2 = new Project(project);
const skeleton2 = new Skeleton(skeleton);
const setters2 = new Setters();
const material = new Material(editor);
const config = engineConfig;
const event = new Event(editor, { prefix: 'common' });
const logger = getLogger({ level: 'warn', bizName: 'common' });
export { export {
editor, editor,
@ -76,15 +98,22 @@ export {
const getSelection = () => designer.currentDocument?.selection; const getSelection = () => designer.currentDocument?.selection;
// TODO: build-plugin-component 的 umd 开发态没有导出 AliLowCodeEngine这里先简单绕过 // TODO: build-plugin-component 的 umd 开发态没有导出 AliLowCodeEngine这里先简单绕过
(window as any).AliLowCodeEngine = { (window as any).AliLowCodeEngine = {
/**
* start
*/
editor, editor,
editorCabin, editorCabin,
// skeleton,
skeletonCabin, skeletonCabin,
designer, designer,
designerCabin, designerCabin,
/**
* end
*/
plugins, plugins,
// setters, skeleton: skeleton2,
project, project: project2,
setters: setters2,
material,
// get selection() { // get selection() {
// return getSelection(); // return getSelection();
// }, // },
@ -100,6 +129,10 @@ const getSelection = () => designer.currentDocument?.selection;
monitor, monitor,
init, init,
utils, utils,
config,
event,
logger,
hotkey,
// engineConfig, // engineConfig,
}; };