mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { WidgetViewMapIdentifier } from '../identifier.js';
|
||||
import type { WidgetViewMapType } from '../spec/type.js';
|
||||
import type { ExtensionType } from './extension.js';
|
||||
|
||||
/**
|
||||
* Create a widget view map extension.
|
||||
*
|
||||
* @param flavour The flavour of the block that the widget view map is for.
|
||||
* @param widgetViewMap A map of widget names to widget view lit literal.
|
||||
*
|
||||
* A widget view map is to provide a map of widgets to a block.
|
||||
* For every target block, it's view will be rendered with the widget views.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { WidgetViewMapExtension } from '@blocksuite/block-std';
|
||||
*
|
||||
* const MyWidgetViewMapExtension = WidgetViewMapExtension('my-flavour', {
|
||||
* 'my-widget': literal`my-widget-view`
|
||||
* });
|
||||
*/
|
||||
export function WidgetViewMapExtension(
|
||||
flavour: BlockSuite.Flavour,
|
||||
widgetViewMap: WidgetViewMapType
|
||||
): ExtensionType {
|
||||
return {
|
||||
setup: di => {
|
||||
di.addImpl(WidgetViewMapIdentifier(flavour), () => widgetViewMap);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user