enhance(api): managing property choice values

This commit is contained in:
charlie
2026-01-16 18:16:16 +08:00
parent 56a38abb47
commit e94959690d
3 changed files with 7 additions and 0 deletions

View File

@@ -793,6 +793,7 @@ export interface IEditorProxy extends Record<string, any> {
* */
setBlockIcon: (blockId: BlockIdentity, iconType: 'tabler-icon' | 'emoji', iconName: string) => Promise<void>
removeBlockIcon: (blockId: BlockIdentity) => Promise<void>
addPropertyValueChoices: (propertyId: BlockIdentity, choices: Array<BlockIdentity>) => Promise<void>
prependBlockInPage: (
page: PageIdentity,

View File

@@ -214,6 +214,7 @@
(def ^:export remove_tag_property db-based-api/tag-remove-property)
(def ^:export set_block_icon db-based-api/set-block-icon)
(def ^:export remove_block_icon db-based-api/remove-block-icon)
(def ^:export add_property_value_choices db-based-api/add-property-value-choices)
;; Internal db-based CLI APIs
;; CLI APIs should use ensure-db-graph unless they have a nested check in cli-common-mcp-tools ns

View File

@@ -381,3 +381,8 @@
block (db-async/<get-block repo block-id)]
(db-property-handler/remove-block-property! (:block/uuid block)
:logseq.property/icon)))
(defn add-property-value-choices [property-id ^js choices]
(when-let [values (and property-id (bean/->clj choices))]
(db-property-handler/add-existing-values-to-closed-values!
property-id values)))