mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
refactor(editor): rename model.doc to store (#12172)
This commit is contained in:
@@ -21,7 +21,7 @@ export const dataViewSlashMenuConfig: SlashMenuConfig = {
|
||||
},
|
||||
group: '7_Database@1',
|
||||
when: ({ model, std }) =>
|
||||
!isInsideBlockByFlavour(model.doc, model, 'affine:edgeless-text') &&
|
||||
!isInsideBlockByFlavour(model.store, model, 'affine:edgeless-text') &&
|
||||
!!std.get(FeatureFlagService).getFlag('enable_block_query'),
|
||||
|
||||
action: ({ model, std }) => {
|
||||
@@ -43,7 +43,7 @@ export const dataViewSlashMenuConfig: SlashMenuConfig = {
|
||||
dataView?.dataSource.viewManager.viewAdd('table');
|
||||
|
||||
if (model.text?.length === 0) {
|
||||
model.doc.deleteBlock(model);
|
||||
model.store.deleteBlock(model);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -169,7 +169,7 @@ export class BlockQueryDataSource extends DataSourceBase {
|
||||
insertToPosition: InsertToPosition,
|
||||
type: string | undefined
|
||||
): string {
|
||||
const doc = this.block.doc;
|
||||
const doc = this.block.store;
|
||||
doc.captureSync();
|
||||
const column = DatabaseBlockDataSource.propertiesMap.value[
|
||||
type ?? propertyPresets.multiSelectPropertyConfig.type
|
||||
@@ -292,7 +292,7 @@ export class BlockQueryDataSource extends DataSourceBase {
|
||||
].config.propertyData.default(),
|
||||
cells: currentCells.map(() => undefined),
|
||||
};
|
||||
this.block.doc.captureSync();
|
||||
this.block.store.captureSync();
|
||||
viewColumn.type = toType;
|
||||
viewColumn.data = result.property;
|
||||
currentCells.forEach((value, i) => {
|
||||
|
||||
@@ -24,21 +24,21 @@ export class DataViewBlockModel extends BlockModel<Props> {
|
||||
}
|
||||
|
||||
applyViewsUpdate() {
|
||||
this.doc.updateBlock(this, {
|
||||
this.store.updateBlock(this, {
|
||||
views: this.props.views,
|
||||
});
|
||||
}
|
||||
|
||||
deleteView(id: string) {
|
||||
this.doc.captureSync();
|
||||
this.doc.transact(() => {
|
||||
this.store.captureSync();
|
||||
this.store.transact(() => {
|
||||
this.props.views = this.props.views.filter(v => v.id !== id);
|
||||
});
|
||||
}
|
||||
|
||||
duplicateView(id: string): string {
|
||||
const newId = this.doc.workspace.idGenerator();
|
||||
this.doc.transact(() => {
|
||||
const newId = this.store.workspace.idGenerator();
|
||||
this.store.transact(() => {
|
||||
const index = this.props.views.findIndex(v => v.id === id);
|
||||
const view = this.props.views[index];
|
||||
if (view) {
|
||||
@@ -53,7 +53,7 @@ export class DataViewBlockModel extends BlockModel<Props> {
|
||||
}
|
||||
|
||||
moveViewTo(id: string, position: InsertToPosition) {
|
||||
this.doc.transact(() => {
|
||||
this.store.transact(() => {
|
||||
this.props.views = arrayMove(
|
||||
this.props.views,
|
||||
v => v.id === id,
|
||||
@@ -67,7 +67,7 @@ export class DataViewBlockModel extends BlockModel<Props> {
|
||||
id: string,
|
||||
update: (data: DataViewDataType) => Partial<DataViewDataType>
|
||||
) {
|
||||
this.doc.transact(() => {
|
||||
this.store.transact(() => {
|
||||
this.props.views = this.props.views.map(v => {
|
||||
if (v.id !== id) {
|
||||
return v;
|
||||
|
||||
Reference in New Issue
Block a user