enhance(apis): add reset option to upsertBlockProperty for block properties

This commit is contained in:
charlie
2026-01-01 16:15:01 +08:00
parent aafa50dcc7
commit 460eefb960
2 changed files with 8 additions and 2 deletions

View File

@@ -834,7 +834,10 @@ export interface IEditorProxy extends Record<string, any> {
upsertBlockProperty: (
block: BlockIdentity | EntityID,
key: string,
value: any
value: any,
options?: Partial<{
reset: boolean
}>
) => Promise<void>
removeBlockProperty: (block: BlockIdentity | EntityID, key: string) => Promise<void>

View File

@@ -419,7 +419,10 @@
(p/let [key' (api-block/sanitize-user-property-name key)
opts (bean/->clj options)
block (<get-block id {:children? false})
value (bean/->clj value)]
value (bean/->clj value)
opts (cond-> opts
(boolean? (:reset opts))
(assoc :reset-property-values (:reset opts)))]
(when block
(db-based-api/upsert-block-property this block key' value opts)))))