mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-22 20:41:50 +08:00
refactor(editor): rename store api (#9518)
This commit is contained in:
@@ -53,7 +53,7 @@ todoMeta.addProperty({
|
||||
metaConfig: propertyPresets.textPropertyConfig,
|
||||
get: block => block.doc.meta?.title ?? '',
|
||||
updated: (block, callback) => {
|
||||
return block.doc.collection.slots.docListUpdated.on(() => {
|
||||
return block.doc.workspace.slots.docListUpdated.on(() => {
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -59,7 +59,7 @@ export class BlockQueryDataSource extends DataSourceBase {
|
||||
}
|
||||
|
||||
get workspace() {
|
||||
return this.host.doc.collection;
|
||||
return this.host.doc.workspace;
|
||||
}
|
||||
|
||||
constructor(
|
||||
@@ -73,14 +73,14 @@ export class BlockQueryDataSource extends DataSourceBase {
|
||||
this.columnMetaMap.set(property.metaConfig.type, property.metaConfig);
|
||||
}
|
||||
for (const collection of this.workspace.docs.values()) {
|
||||
for (const block of Object.values(collection.getDoc().blocks.peek())) {
|
||||
for (const block of Object.values(collection.getBlocks().blocks.peek())) {
|
||||
if (this.meta.selector(block)) {
|
||||
this.blockMap.set(block.id, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.workspace.docs.forEach(doc => {
|
||||
this.listenToDoc(doc.getDoc());
|
||||
this.listenToDoc(doc.getBlocks());
|
||||
});
|
||||
this.workspace.slots.docCreated.on(id => {
|
||||
const doc = this.workspace.getDoc(id);
|
||||
@@ -167,7 +167,7 @@ export class BlockQueryDataSource extends DataSourceBase {
|
||||
type ?? propertyPresets.multiSelectPropertyConfig.type
|
||||
].create(this.newColumnName());
|
||||
|
||||
const id = doc.collection.idGenerator();
|
||||
const id = doc.workspace.idGenerator();
|
||||
if (this.block.columns.some(v => v.id === id)) {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export class DataViewBlockModel extends BlockModel<Props> {
|
||||
}
|
||||
|
||||
duplicateView(id: string): string {
|
||||
const newId = this.doc.collection.idGenerator();
|
||||
const newId = this.doc.workspace.idGenerator();
|
||||
this.doc.transact(() => {
|
||||
const index = this.views.findIndex(v => v.id === id);
|
||||
const view = this.views[index];
|
||||
|
||||
Reference in New Issue
Block a user