mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
chore(editor): rename std.doc to std.store (#9596)
This commit is contained in:
@@ -14,7 +14,7 @@ export const getBlockIndexCommand: Command<
|
||||
'`path` is required, you need to pass it in args or ctx before adding this command to the pipeline.'
|
||||
);
|
||||
|
||||
const parentModel = ctx.std.doc.getParent(path);
|
||||
const parentModel = ctx.std.store.getParent(path);
|
||||
if (!parentModel) return;
|
||||
|
||||
const parent = ctx.std.view.getBlock(parentModel.id);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getNextContentBlock } from '../../utils/index.js';
|
||||
|
||||
function getNextBlock(std: BlockSuite.Std, path: string) {
|
||||
const view = std.view;
|
||||
const model = std.doc.getBlock(path)?.model;
|
||||
const model = std.store.getBlock(path)?.model;
|
||||
if (!model) return null;
|
||||
const nextModel = getNextContentBlock(std.host, model);
|
||||
if (!nextModel) return null;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getPrevContentBlock } from '../../utils/index.js';
|
||||
function getPrevBlock(std: BlockSuite.Std, path: string) {
|
||||
const view = std.view;
|
||||
|
||||
const model = std.doc.getBlock(path)?.model;
|
||||
const model = std.store.getBlock(path)?.model;
|
||||
if (!model) return null;
|
||||
const prevModel = getPrevContentBlock(std.host, model);
|
||||
if (!prevModel) return null;
|
||||
|
||||
@@ -51,7 +51,7 @@ export const getSelectedBlocksCommand: Command<
|
||||
const blockSelections = ctx.blockSelections ?? ctx.currentBlockSelections;
|
||||
if (types.includes('block') && blockSelections) {
|
||||
const viewStore = ctx.std.view;
|
||||
const doc = ctx.std.doc;
|
||||
const doc = ctx.std.store;
|
||||
const selectedBlockComponents = blockSelections.flatMap(selection => {
|
||||
const el = viewStore.getBlock(selection.blockId);
|
||||
if (!el) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export const copySelectedModelsCommand: Command<'draftedModels' | 'onCopy'> = (
|
||||
|
||||
models
|
||||
.then(models => {
|
||||
const slice = Slice.fromModels(ctx.std.doc, models);
|
||||
const slice = Slice.fromModels(ctx.std.store, models);
|
||||
|
||||
return ctx.std.clipboard.copy(slice);
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ export const deleteSelectedModelsCommand: Command<'selectedModels'> = (
|
||||
}
|
||||
|
||||
models.forEach(model => {
|
||||
ctx.std.doc.deleteBlock(model);
|
||||
ctx.std.store.deleteBlock(model);
|
||||
});
|
||||
|
||||
return next();
|
||||
|
||||
@@ -9,17 +9,17 @@ export const duplicateSelectedModelsCommand: Command<
|
||||
|
||||
const model = selectedModels[selectedModels.length - 1];
|
||||
|
||||
const parentModel = std.doc.getParent(model.id);
|
||||
const parentModel = std.store.getParent(model.id);
|
||||
if (!parentModel) return;
|
||||
|
||||
const index = parentModel.children.findIndex(x => x.id === model.id);
|
||||
|
||||
draftedModels
|
||||
.then(models => {
|
||||
const slice = Slice.fromModels(std.doc, models);
|
||||
const slice = Slice.fromModels(std.store, models);
|
||||
return std.clipboard.duplicateSlice(
|
||||
slice,
|
||||
std.doc,
|
||||
std.store,
|
||||
parentModel.id,
|
||||
index + 1
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user