enhance(apis): rename tag functions to block tag for clarity and update version

This commit is contained in:
charlie
2025-11-05 17:02:38 +08:00
parent 51fbc705de
commit 9eb65b473e
4 changed files with 7 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@logseq/libs",
"version": "0.2.4",
"version": "0.2.5",
"description": "Logseq SDK libraries",
"main": "dist/lsplugin.user.js",
"typings": "index.d.ts",

View File

@@ -781,8 +781,8 @@ export interface IEditorProxy extends Record<string, any> {
getAllProperties: () => Promise<PageEntity[] | null>
getTagObjects: (PageIdentity) => Promise<BlockEntity[] | null>
createTag: (tagName: string) => Promise<PageEntity | null>
addTag: (blockId: BlockIdentity, tagId: BlockIdentity) => Promise<void>
removeTag: (blockId: BlockIdentity, tagId: BlockIdentity) => Promise<void>
addBlockTag: (blockId: BlockIdentity, tagId: BlockIdentity) => Promise<void>
removeBlockTag: (blockId: BlockIdentity, tagId: BlockIdentity) => Promise<void>
prependBlockInPage: (
page: PageIdentity,

View File

@@ -201,8 +201,8 @@
(def ^:export get_all_properties db-based-api/get-all-properties)
(def ^:export get_tag_objects db-based-api/get-tag-objects)
(def ^:export create_tag db-based-api/create-tag)
(def ^:export add_tag db-based-api/add-tag)
(def ^:export remove_tag db-based-api/remove-tag)
(def ^:export add_block_tag db-based-api/add-block-tag)
(def ^:export remove_block_tag db-based-api/remove-block-tag)
;; Internal db-based CLI APIs
(def ^:export list_tags cli-based-api/list-tags)

View File

@@ -202,14 +202,14 @@
(when tag
(sdk-utils/result->js tag))))
(defn add-tag [id-or-name tag-id]
(defn add-block-tag [id-or-name tag-id]
(p/let [repo (state/get-current-repo)
tag (db-async/<get-block repo tag-id)
block (db-async/<get-block repo id-or-name)]
(when (and tag block)
(db-page-handler/add-tag repo (:db/id block) tag))))
(defn remove-tag [id-or-name tag-id]
(defn remove-block-tag [id-or-name tag-id]
(p/let [repo (state/get-current-repo)
block (db-async/<get-block repo id-or-name)
tag (db-async/<get-block repo tag-id)]