diff --git a/libs/components/editor-core/src/editor/block/async-block.ts b/libs/components/editor-core/src/editor/block/async-block.ts index 8c422b9963..df2f6d972c 100644 --- a/libs/components/editor-core/src/editor/block/async-block.ts +++ b/libs/components/editor-core/src/editor/block/async-block.ts @@ -453,6 +453,18 @@ export class AsyncBlock { }); } + async removeProperty< + T extends keyof DefaultColumnsValue = keyof DefaultColumnsValue + >(key: T) { + return this.services.update({ + id: this.id, + workspace: this.raw_data.workspace, + properties: { + [key]: undefined, + }, + }); + } + private async load_node(id: string): Promise { return await this.services.load({ workspace: this.raw_data.workspace, diff --git a/libs/datasource/db-service/src/services/editor-block/index.ts b/libs/datasource/db-service/src/services/editor-block/index.ts index 3ff930802d..1bec99a5b9 100644 --- a/libs/datasource/db-service/src/services/editor-block/index.ts +++ b/libs/datasource/db-service/src/services/editor-block/index.ts @@ -143,8 +143,13 @@ export class EditorBlock extends ServiceBaseClass { const decorations = db_block.getDecorations(); Object.entries(businessBlock.properties || {}).forEach( ([key, value]) => { + if (value === undefined) { + db_block.removeDecoration(key); + return; + } if (decorations[key] !== value) { db_block.setDecoration(key, value); + return; } } );