Skip to content

Commit

Permalink
refactor(plugin-command): add plugin-command package
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Feb 1, 2024
1 parent 5657d9c commit aa8e989
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@alilc/lowcode-shell": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-workspace": "1.3.1",
"@alilc/lowcode-plugin-command": "1.3.1",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/engine/src/engine-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry';
import { shellModelFactory } from './modules/shell-model-factory';
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
import { defaultContextMenu } from './inner-plugins/default-context-menu';
import { defaultCommand } from '@alilc/lowcode-plugin-command';
import { CommandPlugin } from '@alilc/lowcode-plugin-command';
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';

export * from './modules/skeleton-types';
Expand All @@ -84,7 +84,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
await plugins.register(builtinHotkey);
await plugins.register(registerDefaults, {}, { autoInit: true });
await plugins.register(defaultContextMenu);
await plugins.register(defaultCommand, {});
await plugins.register(CommandPlugin, {});

return () => {
plugins.delete(OutlinePlugin.pluginName);
Expand All @@ -94,7 +94,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
plugins.delete(builtinHotkey.pluginName);
plugins.delete(registerDefaults.pluginName);
plugins.delete(defaultContextMenu.pluginName);
plugins.delete(defaultCommand.pluginName);
plugins.delete(CommandPlugin.pluginName);
};
}

Expand Down
6 changes: 4 additions & 2 deletions packages/plugin-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
"author": "liujuping <[email protected]>",
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
"license": "ISC",
"main": "lib/plugin-command.js",
"main": "lib/index.js",
"module": "es/index.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
"lib",
"es"
],
"publishConfig": {
"access": "public"
Expand Down
8 changes: 5 additions & 3 deletions packages/plugin-command/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-typ
import { nodeCommand } from './node-command';
import { historyCommand } from './history-command';

export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
export const CommandPlugin: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
const { plugins } = ctx;

return {
Expand All @@ -17,7 +17,9 @@ export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext
};
};

defaultCommand.pluginName = '___default_command___';
defaultCommand.meta = {
CommandPlugin.pluginName = '___default_command___';
CommandPlugin.meta = {
commandScope: 'common',
};

export default CommandPlugin;

0 comments on commit aa8e989

Please sign in to comment.