fix(editor): crud this error (#9350)

This commit is contained in:
Mirone
2024-12-26 19:32:34 +08:00
committed by GitHub
parent 690a79b905
commit 0c849e12c6
@@ -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;