mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 13:15:51 +08:00
feat(editor): improve api for store, and add docs (#10941)
This commit is contained in:
@@ -1091,7 +1091,7 @@ export class EdgelessClipboardController extends PageClipboard {
|
||||
const newSelected = [
|
||||
...canvasElementIds,
|
||||
...blockIds.filter(id => {
|
||||
return isTopLevelBlock(this.doc.getBlockById(id));
|
||||
return isTopLevelBlock(this.doc.getModelById(id));
|
||||
}),
|
||||
];
|
||||
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ export class EdgelessAutoComplete extends WithDisposable(LitElement) {
|
||||
this.edgeless
|
||||
);
|
||||
} else {
|
||||
const model = doc.getBlockById(id);
|
||||
const model = doc.getModelById(id);
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ export class NoteSlicer extends WidgetComponent<
|
||||
doc.root?.id
|
||||
);
|
||||
|
||||
doc.moveBlocks(resetBlocks, doc.getBlockById(newNoteId) as NoteBlockModel);
|
||||
doc.moveBlocks(resetBlocks, doc.getModelById(newNoteId) as NoteBlockModel);
|
||||
|
||||
this._activeSlicerIndex = 0;
|
||||
this._selection.set({
|
||||
|
||||
@@ -188,7 +188,7 @@ export class TemplateJob {
|
||||
if (isMergeBlock) {
|
||||
this._mergeProps(
|
||||
json,
|
||||
this.model.doc.getBlockById(
|
||||
this.model.doc.getModelById(
|
||||
this._getMergeBlockId(json)
|
||||
) as BlockModel
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user