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

@@ -37,7 +37,7 @@ const snapshotTest = async (snapshotUrl: string, elementsCount: number) => {
throw e;
});
const [newDoc] = await transformer.importDocs(
window.editor.doc.collection,
window.editor.doc.workspace,
snapshotFile
);

View File

@@ -59,7 +59,7 @@ async function createEditor(collection: TestWorkspace, mode: DocMode = 'page') {
const app = document.createElement('div');
const blockCollection = collection.docs.values().next().value;
assertExists(blockCollection, 'Need to create a doc first');
const doc = blockCollection.getDoc();
const doc = blockCollection.getBlocks();
const editor = new AffineEditorContainer();
editor.doc = doc;
editor.mode = mode;

View File

@@ -44,7 +44,7 @@ export class CommentManager {
}
const { quote, range } = parseResult;
const id = this.host.doc.collection.idGenerator();
const id = this.host.doc.workspace.idGenerator();
const comment: Comment = {
id,
date: Date.now(),

View File

@@ -84,7 +84,7 @@ export class DocTitle extends WithDisposable(ShadowlessElement) {
};
private readonly _updateTitleInMeta = () => {
this.doc.collection.meta.setDocMeta(this.doc.id, {
this.doc.workspace.meta.setDocMeta(this.doc.id, {
title: this._rootModel.title.toString(),
});
};

View File

@@ -170,7 +170,7 @@ export class OutlineBlockPreview extends SignalWatcher(
if (delta.attributes?.reference) {
// If linked doc, render linked doc icon and the doc title.
const refAttribute = delta.attributes.reference;
const refMeta = block.doc.collection.meta.docMetas.find(
const refMeta = block.doc.workspace.meta.docMetas.find(
doc => doc.id === refAttribute.pageId
);
const unavailable = !refMeta;