mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
feat(editor): improve api for store, and add docs (#10941)
This commit is contained in:
@@ -27,7 +27,7 @@ export const database: InitFn = (collection: Workspace, id: string) => {
|
||||
// Add note block inside root block
|
||||
const noteId = doc.addBlock('affine:note', {}, rootId);
|
||||
const pId = doc.addBlock('affine:paragraph', {}, noteId);
|
||||
const model = doc.getBlockById(pId);
|
||||
const model = doc.getModelById(pId);
|
||||
if (!model) {
|
||||
throw new Error('model is not found');
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export const database: InitFn = (collection: Workspace, id: string) => {
|
||||
},
|
||||
noteId
|
||||
);
|
||||
const database = doc.getBlockById(databaseId) as DatabaseBlockModel;
|
||||
const database = doc.getModelById(databaseId) as DatabaseBlockModel;
|
||||
const datasource = new DatabaseBlockDataSource(database);
|
||||
datasource.viewManager.viewAdd('table');
|
||||
database.props.title = new Text(title);
|
||||
|
||||
Reference in New Issue
Block a user