diff --git a/packages/framework/block-std/src/gfx/controller.ts b/packages/framework/block-std/src/gfx/controller.ts index 6a7d9858c1ab..225fcc3e4c76 100644 --- a/packages/framework/block-std/src/gfx/controller.ts +++ b/packages/framework/block-std/src/gfx/controller.ts @@ -274,11 +274,15 @@ export class GfxController extends LifeCycleWatcher { this._disposables.dispose(); } - updateElement(element: GfxModel, props: Record): void { - if (this.surface?.hasElementById(element.id)) { - this.surface.updateElement(element.id, props); + updateElement( + element: GfxModel | string, + props: Record + ): void { + const elemId = typeof element === 'string' ? element : element.id; + if (this.surface?.hasElementById(elemId)) { + this.surface.updateElement(elemId, props); } else { - const hasBlock = this.doc.hasBlock(element.id); + const hasBlock = this.doc.hasBlock(elemId); hasBlock && this.doc.updateBlock(element as GfxBlockElementModel, props); } }