Allow hooking into command palette commands and command loaders #58200
Labels
[Feature] Extensibility
The ability to extend blocks or the editing experience
[Package] Commands
/packages/commands
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
A plugin might need to hook into specific commands or command loaders used in the command palette in order to fire a parallel action when the hook is executed.
This can be achieved by registering a new command like the original but running the plugin logic inside the callback. Something like:
While that works, it has some drawbacks, like having to iterate through all commands every time the command palette is opened, being error-prone in case a plugin abuses the system or modifies the command callback signature, etc.
What is your proposed solution?
If there was a hook plugins could use to attach some logic to existing commands, the code above would be greatly simplified, helping make it more future-proof and less likely to break.
I'm thinking of an API similar to
addAction()
or something on top of that. Each command could run its owndoAction()
, this way plugins that only extend one specific action would only need to add the action to the particular command.Use cases
The text was updated successfully, but these errors were encountered: