Просмотр исходного кода

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

charlie 1 месяц назад
Родитель
Сommit
9eb65b473e
4 измененных файлов с 7 добавлено и 7 удалено
  1. 1 1
      libs/package.json
  2. 2 2
      libs/src/LSPlugin.ts
  3. 2 2
      src/main/logseq/api.cljs
  4. 2 2
      src/main/logseq/api/db_based.cljs

+ 1 - 1
libs/package.json

@@ -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",

+ 2 - 2
libs/src/LSPlugin.ts

@@ -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,

+ 2 - 2
src/main/logseq/api.cljs

@@ -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)

+ 2 - 2
src/main/logseq/api/db_based.cljs

@@ -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)]