mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 03:33:06 +08:00
fix(editor): crud this error (#9350)
This commit is contained in:
@@ -34,7 +34,7 @@ export class EdgelessCRUDExtension extends Extension {
|
|||||||
return this._gfx.surface as SurfaceBlockModel | null;
|
return this._gfx.surface as SurfaceBlockModel | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteElements(elements: BlockSuite.EdgelessModel[]) {
|
deleteElements = (elements: BlockSuite.EdgelessModel[]) => {
|
||||||
const surface = this._surface;
|
const surface = this._surface;
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
console.error('surface is not initialized');
|
console.error('surface is not initialized');
|
||||||
@@ -60,14 +60,14 @@ export class EdgelessCRUDExtension extends Extension {
|
|||||||
gfx.deleteElement(element.id);
|
gfx.deleteElement(element.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
addBlock(
|
addBlock = (
|
||||||
flavour: BlockSuite.EdgelessModelKeys | string,
|
flavour: BlockSuite.EdgelessModelKeys | string,
|
||||||
props: Record<string, unknown>,
|
props: Record<string, unknown>,
|
||||||
parentId?: string | BlockModel,
|
parentId?: string | BlockModel,
|
||||||
parentIndex?: number
|
parentIndex?: number
|
||||||
) {
|
) => {
|
||||||
const gfx = this.std.get(GfxControllerIdentifier);
|
const gfx = this.std.get(GfxControllerIdentifier);
|
||||||
const key = getLastPropsKey(flavour as BlockSuite.EdgelessModelKeys, props);
|
const key = getLastPropsKey(flavour as BlockSuite.EdgelessModelKeys, props);
|
||||||
if (key) {
|
if (key) {
|
||||||
@@ -85,9 +85,9 @@ export class EdgelessCRUDExtension extends Extension {
|
|||||||
parentId,
|
parentId,
|
||||||
parentIndex
|
parentIndex
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
addElement<T extends Record<string, unknown>>(type: string, props: T) {
|
addElement = <T extends Record<string, unknown>>(type: string, props: T) => {
|
||||||
const surface = this._surface;
|
const surface = this._surface;
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
console.error('surface is not initialized');
|
console.error('surface is not initialized');
|
||||||
@@ -107,7 +107,7 @@ export class EdgelessCRUDExtension extends Extension {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return surface.addElement(nProps);
|
return surface.addElement(nProps);
|
||||||
}
|
};
|
||||||
|
|
||||||
updateElement = (id: string, props: Record<string, unknown>) => {
|
updateElement = (id: string, props: Record<string, unknown>) => {
|
||||||
const surface = this._surface;
|
const surface = this._surface;
|
||||||
|
|||||||
Reference in New Issue
Block a user