refactor(editor): rename model.doc to store (#12172)

This commit is contained in:
Saul-Mirone
2025-05-07 09:17:01 +00:00
parent eb62d0e853
commit 95b9e4b3d0
95 changed files with 264 additions and 246 deletions

View File

@@ -80,7 +80,7 @@ export const replaceIdMiddleware =
model.props.reference = idMap.get(original)!;
} else if (
model.props.refFlavour === 'affine:frame' &&
!model.doc.hasBlock(original)
!model.store.hasBlock(original)
) {
const newId = idGenerator();
idMap.set(original, newId);

View File

@@ -45,7 +45,7 @@ export function calcDropTarget(
*/
allowSublist: boolean = true
): DropTarget | null {
const schema = model.doc.schema.get('affine:database');
const schema = model.store.schema.get('affine:database');
const children = schema?.model.children ?? [];
let shouldAppendToDatabase = true;

View File

@@ -26,7 +26,7 @@ export function getPrevContentBlock(
model: BlockModel
): BlockModel | null {
const getPrev = (model: BlockModel) => {
const parent = model.doc.getParent(model);
const parent = model.store.getParent(model);
if (!parent) return null;
const index = parent.children.indexOf(model);
@@ -113,7 +113,7 @@ export function getNextContentBlock(
}
map[model.id] = true;
const doc = model.doc;
const doc = model.store;
if (model.children.length) {
return model.children[0];
}

View File

@@ -5,7 +5,7 @@ export function mergeToCodeModel(models: BlockModel[]) {
if (models.length === 0) {
return null;
}
const doc = models[0].doc;
const doc = models[0].store;
const parent = doc.getParent(models[0]);
if (!parent) {

View File

@@ -5,7 +5,7 @@ export function transformModel(
flavour: string,
props?: Parameters<Store['addBlock']>[1]
) {
const doc = model.doc;
const doc = model.store;
const parent = doc.getParent(model);
if (!parent) {
return null;