mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
docs(editor): scaffolding docs generator (#10925)
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import type { Container } from '@blocksuite/global/di';
|
||||
|
||||
/**
|
||||
* Generic extension.
|
||||
* Extensions are used to set up the dependency injection container.
|
||||
* In most cases, you won't need to use this class directly.
|
||||
* We provide helper classes like `CommandExtension` and `BlockViewExtension` to make it easier to create extensions.
|
||||
*
|
||||
* # Understanding Extensions
|
||||
*
|
||||
* Extensions provide a way to extend the functionality of a system using dependency injection.
|
||||
@@ -125,6 +120,8 @@ import type { Container } from '@blocksuite/global/di';
|
||||
* pattern can be applied to any entity that can be configured by third parties, not just blocks.
|
||||
* This includes different tools in the whiteboard, different column types in database blocks,
|
||||
* and many other extensible components. The pattern remains the same regardless of what you're extending.
|
||||
*
|
||||
* @category Extension
|
||||
*/
|
||||
export abstract class Extension {
|
||||
static setup(_di: Container): void {
|
||||
|
||||
@@ -10,15 +10,31 @@ export const StoreExtensionIdentifier =
|
||||
|
||||
export const storeExtensionSymbol = Symbol('StoreExtension');
|
||||
|
||||
/**
|
||||
* Store extensions are used to extend the store.
|
||||
* They should be registered to the store. And they should be able to run in a none-dom environment.
|
||||
*
|
||||
* @category Extension
|
||||
*/
|
||||
export class StoreExtension extends Extension {
|
||||
/**
|
||||
* The key of the store extension.
|
||||
* **You must override this property with a unique string.**
|
||||
*/
|
||||
static readonly key: string;
|
||||
|
||||
constructor(readonly store: Store) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lifecycle hook when the yjs document is loaded.
|
||||
*/
|
||||
loaded() {}
|
||||
|
||||
/**
|
||||
* Lifecycle hook when the yjs document is disposed.
|
||||
*/
|
||||
disposed() {}
|
||||
|
||||
static readonly [storeExtensionSymbol] = true;
|
||||
|
||||
@@ -42,6 +42,7 @@ export type DocCollectionOptions = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Test only
|
||||
* Do not use this in production
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user