refactor(editor): align rich text util apis (#11039)

This commit is contained in:
Saul-Mirone
2025-03-20 10:40:11 +00:00
parent 77e659d0b0
commit 66ea3038af
18 changed files with 57 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
import { NoteBlockModel, NoteDisplayMode } from '@blocksuite/affine-model';
import type { BlockComponent, EditorHost } from '@blocksuite/block-std';
import type { BlockComponent, BlockStdScope } from '@blocksuite/block-std';
import type { BlockModel, Store } from '@blocksuite/store';
import { matchModels } from './checker.js';
@@ -23,16 +23,16 @@ export function findAncestorModel(
*
*/
export async function asyncGetBlockComponent(
editorHost: EditorHost,
std: BlockStdScope,
id: string
): Promise<BlockComponent | null> {
const rootBlockId = editorHost.doc.root?.id;
const rootBlockId = std.store.root?.id;
if (!rootBlockId) return null;
const rootComponent = editorHost.view.getBlock(rootBlockId);
const rootComponent = std.view.getBlock(rootBlockId);
if (!rootComponent) return null;
await rootComponent.updateComplete;
return editorHost.view.getBlock(id);
return std.view.getBlock(id);
}
export function findNoteBlockModel(model: BlockModel) {