Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(core): send actionData list to ActionExtensionManager

Dushusira33792b3716d
diff --git a/packages/core/src/Command/ActionExtensionManager.ts b/packages/core/src/Command/ActionExtensionManager.ts
index e5a8ccf928..e60c83f101 100644
--- a/packages/core/src/Command/ActionExtensionManager.ts
+++ b/packages/core/src/Command/ActionExtensionManager.ts
@@ -1,7 +1,6 @@
import { IActionData } from './ActionBase';
import { BaseActionExtensionFactory } from './ActionExtensionFactory';
import { ActionExtensionRegister } from './ActionExtensionRegister';
-import { CommandBase } from './CommandBase';
export class ActionExtensionManager {
private _actionExtensionFactoryList: Array<
@@ -12,12 +11,12 @@ export class ActionExtensionManager {
* inject all actions
* @param command
*/
- inject(command: CommandBase) {
+ handle(actions: IActionData[]) {
// get the sorted list
// get the dynamically added list
this._actionExtensionFactoryList =
ActionExtensionManager.register.actionExtensionFactoryList;
- this._checkExtension(command);
+ this._checkExtension(actions);
}
/**
@@ -25,15 +24,12 @@ export class ActionExtensionManager {
* @param command
* @returns
*/
- private _checkExtension(command: CommandBase) {
+ private _checkExtension(actions: IActionData[]) {
if (!this._actionExtensionFactoryList) return false;
- const actions = command.getInjector().getActions();
actions.forEach((action) => {
this._actionExtensionFactoryList.forEach((actionExtensionFactory) => {
- const extension = actionExtensionFactory.check(
- action.getDoActionData()
- );
+ const extension = actionExtensionFactory.check(action);
// TODO 可能只需执行一次
if (extension !== false) {
extension.execute();
diff --git a/packages/core/src/Command/CommandBase.ts b/packages/core/src/Command/CommandBase.ts
index 33695db722..8c88e19698 100644
--- a/packages/core/src/Command/CommandBase.ts
+++ b/packages/core/src/Command/CommandBase.ts
@@ -20,7 +20,7 @@ export class CommandBase {
// TODO inject and invoke
const actionExtensionManager = new ActionExtensionManager();
- actionExtensionManager.inject(this);
+ actionExtensionManager.handle(list);
list.forEach((data) => {
const ActionClass = CommandManager.getAction(data.actionName);