mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
refactor(core): move block collection to affine and implement as doc (#9514)
This commit is contained in:
@@ -448,7 +448,7 @@ export const databaseViewInitTemplate = (
|
||||
const rowId = model.doc.addBlock(
|
||||
'affine:paragraph',
|
||||
{
|
||||
text: new model.doc.Text(`Task ${i + 1}`),
|
||||
text: new Text(`Task ${i + 1}`),
|
||||
},
|
||||
model.id
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ export function addProperty(
|
||||
id?: string;
|
||||
}
|
||||
): string {
|
||||
const id = column.id ?? model.doc.generateBlockId();
|
||||
const id = column.id ?? model.doc.collection.idGenerator();
|
||||
if (model.columns.some(v => v.id === id)) {
|
||||
return id;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export function deleteView(model: DatabaseBlockModel, id: string) {
|
||||
}
|
||||
|
||||
export function duplicateView(model: DatabaseBlockModel, id: string): string {
|
||||
const newId = model.doc.generateBlockId();
|
||||
const newId = model.doc.collection.idGenerator();
|
||||
model.doc.transact(() => {
|
||||
const index = model.views.findIndex(v => v.id === id);
|
||||
const view = model.views[index];
|
||||
|
||||
Reference in New Issue
Block a user