mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-22 09:18:11 +00:00
fix: 调整 editor-setters 的加载时机
fix: 导出的 Project 不要去修改引擎内部的 project
This commit is contained in:
parent
9a1178d826
commit
8e667934e4
@ -1,6 +1,6 @@
|
|||||||
import { Editor, Hotkey, hotkey } from '@ali/lowcode-editor-core';
|
import { Editor, Hotkey, hotkey } from '@ali/lowcode-editor-core';
|
||||||
import { Skeleton } from '@ali/lowcode-editor-skeleton';
|
import { Skeleton } from '@ali/lowcode-editor-skeleton';
|
||||||
import { ILowCodePluginConfig, ILowCodePluginManager, ILowCodePluginContext, IDesignerCabin, ILowCodePlugin } from '@ali/lowcode-types';
|
import { ILowCodePluginConfig, ILowCodePluginManager, ILowCodePluginContext, IDesignerCabin } from '@ali/lowcode-types';
|
||||||
import { getLogger, Logger } from '../utils';
|
import { getLogger, Logger } from '../utils';
|
||||||
import {
|
import {
|
||||||
registerMetadataTransducer,
|
registerMetadataTransducer,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
pluginConfig: (ctx: ILowCodePluginContext, options: CompositeObject) => ILowCodePluginConfig,
|
pluginConfig: (ctx: ILowCodePluginContext, options: CompositeObject) => ILowCodePluginConfig,
|
||||||
options: CompositeObject,
|
options: CompositeObject = {},
|
||||||
): void {
|
): void {
|
||||||
const ctx = this._getLowCodePluginContext();
|
const ctx = this._getLowCodePluginContext();
|
||||||
const config = pluginConfig(ctx, options);
|
const config = pluginConfig(ctx, options);
|
||||||
|
|||||||
@ -2,7 +2,8 @@ import { designer } from './editor';
|
|||||||
|
|
||||||
const { project } = designer;
|
const { project } = designer;
|
||||||
|
|
||||||
Object.assign(project, {
|
const visionProject = {};
|
||||||
|
Object.assign(visionProject, project, {
|
||||||
getSchema(): any {
|
getSchema(): any {
|
||||||
return this.schema || {};
|
return this.schema || {};
|
||||||
},
|
},
|
||||||
@ -16,4 +17,4 @@ Object.assign(project, {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default project;
|
export default visionProject;
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import { Skeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-ed
|
|||||||
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 builtinSetters from '@ali/lowcode-editor-setters';
|
|
||||||
import './modules/live-editing';
|
import './modules/live-editing';
|
||||||
|
|
||||||
export * from './modules/editor-types';
|
export * from './modules/editor-types';
|
||||||
@ -20,7 +19,6 @@ export * from './modules/designer-types';
|
|||||||
export * from './modules/lowcode-types';
|
export * from './modules/lowcode-types';
|
||||||
|
|
||||||
const { hotkey, monitor, getSetter, registerSetter } = editorCabin;
|
const { hotkey, monitor, getSetter, registerSetter } = editorCabin;
|
||||||
registerSetter(builtinSetters as any);
|
|
||||||
registerDefaults();
|
registerDefaults();
|
||||||
|
|
||||||
const editor = new Editor();
|
const editor = new Editor();
|
||||||
@ -132,6 +130,9 @@ const getSelection = () => designer.currentDocument?.selection;
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function init(container?: Element) {
|
export async function init(container?: Element) {
|
||||||
|
// 因为这里的 setter 可能已经用到了 VisualEngine 的 API,所以延迟到此加载,而不是一开始就加载
|
||||||
|
const builtinSetters = require('@ali/lowcode-editor-setters').default;
|
||||||
|
registerSetter(builtinSetters as any);
|
||||||
let engineContainer = container;
|
let engineContainer = container;
|
||||||
if (!engineContainer) {
|
if (!engineContainer) {
|
||||||
engineContainer = document.createElement('div');
|
engineContainer = document.createElement('div');
|
||||||
|
|||||||
@ -2,7 +2,8 @@ import { designer } from '@ali/lowcode-engine';
|
|||||||
|
|
||||||
const { project } = designer;
|
const { project } = designer;
|
||||||
|
|
||||||
Object.assign(project, {
|
const visionProject = {};
|
||||||
|
Object.assign(visionProject, project, {
|
||||||
getSchema(): any {
|
getSchema(): any {
|
||||||
return this.schema || {};
|
return this.schema || {};
|
||||||
},
|
},
|
||||||
@ -16,4 +17,4 @@ Object.assign(project, {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default project;
|
export default visionProject;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user