feat(editor): improve api for store, and add docs (#10941)

This commit is contained in:
Saul-Mirone
2025-03-17 16:30:59 +00:00
parent b0aa2c90fd
commit 3de7d85eea
47 changed files with 1212 additions and 210 deletions
@@ -191,7 +191,7 @@ export class PageRootBlockComponent extends BlockComponent<
const { doc } = this;
const noteId = doc.addBlock('affine:note', {}, doc.root?.id);
return doc.getBlockById(noteId) as NoteBlockModel;
return doc.getModelById(noteId) as NoteBlockModel;
}
private _getDefaultNoteBlock() {
@@ -262,7 +262,7 @@ export class PageRootBlockComponent extends BlockComponent<
);
if (!sel) return;
let model: BlockModel | null = null;
let current = this.doc.getBlockById(sel.blockId);
let current = this.doc.getModelById(sel.blockId);
while (current && !model) {
if (current.flavour === 'affine:note') {
model = current;
@@ -280,7 +280,7 @@ export class PageRootBlockComponent extends BlockComponent<
}
return;
}
const notes = this.doc.getBlockByFlavour('affine:note');
const notes = this.doc.getModelsByFlavour('affine:note');
const index = notes.indexOf(prevNote);
if (index !== 0) return;