A life cycle watcher is an extension that watches the life cycle of the editor. It is used to perform actions when the editor is created, mounted, rendered, or unmounted.
When creating a life cycle watcher, you must define a key that is unique to the watcher. The key is used to identify the watcher in the dependency injection container.
Override this method to implement one-time initialization logic for the provider. This method will be called automatically during setup, but only once per provider class.
BlockSuite API Documentation / @blocksuite/affine-inline-comment
@blocksuite/affine-inline-comment
Classes
InlineCommentManager
A life cycle watcher is an extension that watches the life cycle of the editor. It is used to perform actions when the editor is created, mounted, rendered, or unmounted.
When creating a life cycle watcher, you must define a key that is unique to the watcher. The key is used to identify the watcher in the dependency injection container.
In the life cycle watcher, the methods will be called in the following order:
created: Called when the std is created.rendered: Called whenstd.renderis called.mounted: Called when the editor host is mounted.unmounted: Called when the editor host is unmounted.Extends
LifeCycleWatcherConstructors
Properties
key
Overrides
LifeCycleWatcher.keyMethods
getCommentsInEditor()
Returns
string[]mounted()
Called when editor host is mounted. Which means the editor host emit the
connectedCallbacklifecycle event.Returns
voidOverrides
LifeCycleWatcher.mountedunmounted()
Called when editor host is unmounted. Which means the editor host emit the
disconnectedCallbacklifecycle event.Returns
voidOverrides
LifeCycleWatcher.unmountedInlineCommentViewExtension
A specialized extension provider for view-related functionality. Extends the base provider with view-specific scope and configuration.
Example
Extends
ViewExtensionProvider<z.infer<typeofoptionsSchema>>Constructors
Properties
name
The name of the view extension provider
Overrides
ViewExtensionProvider.nameschema
Zod schema for validating provider options
Overrides
ViewExtensionProvider.schemaMethods
effect()
Override this method to implement one-time initialization logic for the provider. This method will be called automatically during setup, but only once per provider class.
Returns
voidExample
Overrides
ViewExtensionProvider.effectsetup()
Sets up the provider with the given context and options. Validates the options against the schema if provided.
Parameters
context
ViewExtensionContextThe context object containing scope and registration function
options?
enabled
boolean=...Returns
voidOverrides
ViewExtensionProvider.setupVariables
CommentInlineSpecExtension
Type Declaration
identifier
NullCommentInlineSpecExtension
Type Declaration
identifier
Functions
extractCommentIdFromDelta()
Parameters
delta
DeltaInsert<AffineTextAttributes>Returns
string[]findAllCommentedTexts()
Parameters
store
StoreReturns
Map<TextSelection,string>findCommentedTexts()
Parameters
store
StorecommentId
stringReturns
TextSelection[]