chore(editor): rename std.doc to std.store (#9596)

This commit is contained in:
Saul-Mirone
2025-01-09 04:16:28 +00:00
parent 58ce86533e
commit d21ef47ae8
89 changed files with 359 additions and 348 deletions

View File

@@ -85,7 +85,7 @@ export class AffineDragHandleWidget extends WidgetComponent<RootBlockModel> {
matchFlavours(this.draggingElements[0].model, ['affine:note']);
if (isDraggedElementNote) {
const parent = this.std.doc.getParent(closestBlock.model);
const parent = this.std.store.getParent(closestBlock.model);
if (!parent) return null;
const parentElement = this._getBlockView(parent.id);
if (!parentElement) return null;

View File

@@ -7,7 +7,7 @@ export const newIdCrossDoc =
let samePage = false;
slots.beforeImport.on(payload => {
if (payload.type === 'slice') {
samePage = payload.snapshot.pageId === std.doc.id;
samePage = payload.snapshot.pageId === std.store.id;
}
if (payload.type === 'block' && !samePage) {
payload.snapshot.id = std.workspace.idGenerator();

View File

@@ -13,10 +13,10 @@ export const reorderList =
matchFlavours(model, ['affine:list']) &&
model.type === 'numbered'
) {
const next = std.doc.getNext(model);
correctNumberedListsOrderToPrev(std.doc, model);
const next = std.store.getNext(model);
correctNumberedListsOrderToPrev(std.store, model);
if (next) {
correctNumberedListsOrderToPrev(std.doc, next);
correctNumberedListsOrderToPrev(std.store, next);
}
}
}

View File

@@ -15,7 +15,7 @@ export const surfaceRefToEmbed =
pageId &&
payload.type === 'block' &&
payload.snapshot.flavour === 'affine:surface-ref' &&
!std.doc.hasBlock(payload.snapshot.id)
!std.store.hasBlock(payload.snapshot.id)
) {
const id = payload.snapshot.id;
payload.snapshot.id = std.workspace.idGenerator();

View File

@@ -285,7 +285,7 @@ export class DragEventWatcher {
return;
}
const model = element.model;
const parent = this._std.doc.getParent(model.id);
const parent = this._std.store.getParent(model.id);
if (!parent) return;
if (matchFlavours(parent, ['affine:surface'])) {
return;
@@ -327,11 +327,11 @@ export class DragEventWatcher {
content: first.children,
};
job
.snapshotToSlice(snapshotWithoutNote, std.doc, parent, index)
.snapshotToSlice(snapshotWithoutNote, std.store, parent, index)
.then(() => {
const block = std.doc.getBlock(id)?.model;
const block = std.store.getBlock(id)?.model;
if (block) {
std.doc.deleteBlock(block);
std.store.deleteBlock(block);
}
})
.catch(console.error);
@@ -363,7 +363,7 @@ export class DragEventWatcher {
const std = this._std;
const job = this._getJob();
job
.snapshotToSlice(snapshot, std.doc, surfaceBlockModel.id)
.snapshotToSlice(snapshot, std.store, surfaceBlockModel.id)
.catch(console.error);
};
@@ -456,7 +456,7 @@ export class DragEventWatcher {
);
const slice = Slice.fromModels(
this._std.doc,
this._std.store,
blocks.map(block => block.model)
);
@@ -467,7 +467,7 @@ export class DragEventWatcher {
};
private readonly _trackLinkedDocCreated = (id: string) => {
const isNewBlock = !this._std.doc.hasBlock(id);
const isNewBlock = !this._std.store.hasBlock(id);
if (!isNewBlock) {
return;
}
@@ -517,7 +517,7 @@ export class DragEventWatcher {
// use snapshot
const slice = await job.snapshotToSlice(
snapshot,
std.doc,
std.store,
parent,
index
);