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