mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 16:46:22 +08:00
refactor(editor): remove dependency of command global types (#9903)
Closes: [BS-2216](https://linear.app/affine-design/issue/BS-2216/remove-global-types-in-command)
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import type { ExtensionType } from '@blocksuite/store';
|
||||
|
||||
import { CommandIdentifier } from '../identifier.js';
|
||||
import type { BlockCommands } from '../spec/index.js';
|
||||
|
||||
/**
|
||||
* Create a command extension.
|
||||
*
|
||||
* @param commands A map of command names to command implementations.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { CommandExtension } from '@blocksuite/block-std';
|
||||
*
|
||||
* const MyCommandExtension = CommandExtension({
|
||||
* 'my-command': MyCommand
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function CommandExtension(commands: BlockCommands): ExtensionType {
|
||||
return {
|
||||
setup: di => {
|
||||
Object.entries(commands).forEach(([name, command]) => {
|
||||
di.addImpl(CommandIdentifier(name), () => command);
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './block-view.js';
|
||||
export * from './command.js';
|
||||
export * from './config.js';
|
||||
export * from './dnd/index.js';
|
||||
export * from './flavour.js';
|
||||
|
||||
Reference in New Issue
Block a user