Skip to content

Commit 460eefb

Browse files
committed
enhance(apis): add reset option to upsertBlockProperty for block properties
1 parent aafa50d commit 460eefb

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

libs/src/LSPlugin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,10 @@ export interface IEditorProxy extends Record<string, any> {
834834
upsertBlockProperty: (
835835
block: BlockIdentity | EntityID,
836836
key: string,
837-
value: any
837+
value: any,
838+
options?: Partial<{
839+
reset: boolean
840+
}>
838841
) => Promise<void>
839842

840843
removeBlockProperty: (block: BlockIdentity | EntityID, key: string) => Promise<void>

src/main/logseq/api/editor.cljs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,10 @@
419419
(p/let [key' (api-block/sanitize-user-property-name key)
420420
opts (bean/->clj options)
421421
block (<get-block id {:children? false})
422-
value (bean/->clj value)]
422+
value (bean/->clj value)
423+
opts (cond-> opts
424+
(boolean? (:reset opts))
425+
(assoc :reset-property-values (:reset opts)))]
423426
(when block
424427
(db-based-api/upsert-block-property this block key' value opts)))))
425428

0 commit comments

Comments
 (0)