mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
refactor(editor): rename model.doc to store (#12172)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user