refactor(editor): rename store api (#9518)

This commit is contained in:
Saul-Mirone
2025-01-04 12:51:56 +00:00
parent 650e4fb6b2
commit c773982ced
83 changed files with 293 additions and 290 deletions

View File

@@ -47,7 +47,7 @@ export class NoteRenderer
}
addNote() {
const collection = this.host?.std.collection;
const collection = this.host?.std.workspace;
if (!collection) {
return;
}

View File

@@ -132,7 +132,7 @@ export class LinkCell extends BaseCellRenderer<string> {
override render() {
const linkText = this.value ?? '';
const docName =
this.docId && this.std?.collection.getDoc(this.docId)?.meta?.title;
this.docId && this.std?.workspace.getDoc(this.docId)?.meta?.title;
return html`
<div class="affine-database-link" @click="${this._onClick}">
${docName

View File

@@ -19,7 +19,7 @@ export const titlePurePropertyConfig = titleColumnType.modelConfig<Text>({
cellToJson: ({ value, dataSource }) => {
const host = dataSource.contextGet(HostContextKey);
if (host) {
const collection = host.std.collection;
const collection = host.std.workspace;
const deltas = value.deltas$.value;
const text = deltas
.map(delta => {

View File

@@ -98,7 +98,7 @@ abstract class BaseTextCell extends BaseCellRenderer<Text> {
if (!this.docId$.value) {
return this.value;
}
const doc = this.host?.std.collection.getDoc(this.docId$.value);
const doc = this.host?.std.workspace.getDoc(this.docId$.value);
const root = doc?.root as RootBlockModel;
return root.title;
});

View File

@@ -19,7 +19,7 @@ export function addProperty(
id?: string;
}
): string {
const id = column.id ?? model.doc.collection.idGenerator();
const id = column.id ?? model.doc.workspace.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.collection.idGenerator();
const newId = model.doc.workspace.idGenerator();
model.doc.transact(() => {
const index = model.views.findIndex(v => v.id === id);
const view = model.views[index];