mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-16 13:57:02 +08:00
chore(editor): rename std.doc to std.store (#9596)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user