mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 15:16:28 +08:00
205cd7a86d
Closes: BS-2946
27 lines
581 B
TypeScript
27 lines
581 B
TypeScript
import type { ExtensionType } from '@blocksuite/store';
|
|
|
|
import { BlockFlavourIdentifier } from '../identifier.js';
|
|
|
|
/**
|
|
* Create a flavour extension.
|
|
*
|
|
* @param flavour
|
|
* The flavour of the block that the extension is for.
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { FlavourExtension } from '@blocksuite/std';
|
|
*
|
|
* const MyFlavourExtension = FlavourExtension('my-flavour');
|
|
* ```
|
|
*/
|
|
export function FlavourExtension(flavour: string): ExtensionType {
|
|
return {
|
|
setup: di => {
|
|
di.addImpl(BlockFlavourIdentifier(flavour), () => ({
|
|
flavour,
|
|
}));
|
|
},
|
|
};
|
|
}
|