Skip to content

Commit

Permalink
feat: export nodeChildrenSymbol && remove some unnecessary editor.set
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoYuan committed May 11, 2022
1 parent 85704c3 commit e83adce
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
13 changes: 12 additions & 1 deletion packages/editor-core/src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ import { AssetsJson, AssetLoader } from '@alilc/lowcode-utils';

EventEmitter.defaultMaxListeners = 100;

// inner instance keys which should not be stored in config
const keyBlacklist = [
'designer',
'skeleton',
'currentDocument',
'simulator',
'plugins',
];

export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalEvent.EventConfig> {
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
Expand Down Expand Up @@ -73,7 +82,9 @@ export class Editor extends (EventEmitter as any) implements IEditor {
return;
}
// store the data to engineConfig while invoking editor.set()
engineConfig.set(key as any, data);
if (!keyBlacklist.includes(key as string)) {
engineConfig.set(key as any, data);
}
this.context.set(key, data);
this.notifyGot(key);
}
Expand Down
4 changes: 0 additions & 4 deletions packages/engine/src/engine-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,10 @@ globalContext.register(editor, Editor);
globalContext.register(editor, 'editor');

const innerSkeleton = new InnerSkeleton(editor);
editor.set(Skeleton, innerSkeleton);
editor.set('skeleton' as any, innerSkeleton);
engineConfig.set('skeleton' as any, innerSkeleton);

const designer = new Designer({ editor });
editor.set(Designer, designer);
editor.set('designer' as any, designer);
engineConfig.set('designer' as any, designer);

const plugins = new LowCodePluginManager(editor).toProxy();
editor.set('plugins' as any, plugins);
Expand Down
2 changes: 2 additions & 0 deletions packages/engine/src/modules/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
projectSymbol,
documentSymbol,
nodeSymbol,
nodeChildrenSymbol,
designerSymbol,
skeletonSymbol,
editorSymbol,
Expand All @@ -13,6 +14,7 @@ export default {
projectSymbol,
documentSymbol,
nodeSymbol,
nodeChildrenSymbol,
skeletonSymbol,
editorSymbol,
designerSymbol,
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer-core/tests/renderer/renderer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import renderer from 'react-test-renderer/';
import renderer from 'react-test-renderer';
import schema from '../fixtures/schema/basic';
import '../utils/react-env-init';
import rendererFactory from '../../src/renderer/renderer';
Expand Down
9 changes: 9 additions & 0 deletions packages/shell/src/hotkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import { hotkey, HotkeyCallback } from '@alilc/lowcode-editor-core';
import { Disposable } from '@alilc/lowcode-types';

export default class Hotkey {
get callbacks() {
return hotkey.callBacks;
}
/**
* @deprecated
*/
get callBacks() {
return this.callbacks;
}
/**
* 绑定快捷键
* @param combos 快捷键,格式如:['command + s'] 、['ctrl + shift + s'] 等
Expand Down

0 comments on commit e83adce

Please sign in to comment.