mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 23:56:36 +08:00
feat: 1. add toc;
This commit is contained in:
@@ -333,6 +333,12 @@ export class Editor implements Virgo {
|
||||
return await this.getBlock({ workspace: this.workspace, id: blockId });
|
||||
}
|
||||
|
||||
async getBlockByIds(ids: string[]): Promise<Awaited<AsyncBlock | null>[]> {
|
||||
return await Promise.all(
|
||||
ids.map(id => this.getBlock({ workspace: this.workspace, id }))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: to be optimized
|
||||
* get block`s dom by block`s id
|
||||
@@ -477,6 +483,13 @@ export class Editor implements Virgo {
|
||||
return await services.api.editorBlock.query(this.workspace, query);
|
||||
}
|
||||
|
||||
async queryByPageId(pageId: string) {
|
||||
return await services.api.editorBlock.get({
|
||||
workspace: this.workspace,
|
||||
ids: [pageId],
|
||||
});
|
||||
}
|
||||
|
||||
/** Hooks */
|
||||
|
||||
public getHooks(): HooksRunner & PluginHooks {
|
||||
|
||||
Reference in New Issue
Block a user