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

+ 1 - 1
libs/package.json

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

+ 6 - 0
libs/src/LSPlugin.ts

@@ -781,6 +781,12 @@ export interface IEditorProxy extends Record<string, any> {
   getAllProperties: () => Promise<PageEntity[] | null>
   getTagObjects: (PageIdentity) => Promise<BlockEntity[] | null>
   createTag: (tagName: string) => Promise<PageEntity | null>
+  addTagClassProperty: (tagId: BlockIdentity, propertyIdOrName: BlockIdentity,
+    opts?: Partial<{
+      type: stirng
+      [key: string]: any
+    }>) => Promise<void>
+  removeTagClassProperty: (tagId: BlockIdentity, propertyIdOrName: BlockIdentity) => Promise<void>
   addBlockTag: (blockId: BlockIdentity, tagId: BlockIdentity) => Promise<void>
   removeBlockTag: (blockId: BlockIdentity, tagId: BlockIdentity) => Promise<void>
 

+ 4 - 1
src/main/logseq/api/db_based.cljs

@@ -204,7 +204,7 @@
     (when tag
       (sdk-utils/result->js tag))))
 
-(defn upsert-property-to-tag [tag-id property-id-or-name & {:keys [schema]}]
+(defn add-tag-class-property [tag-id property-id-or-name & {:keys [schema]}]
   (p/let [repo (state/get-current-repo)
           tag-entity (db-async/<get-block repo tag-id {:children? false})
           class-tag? (some-> tag-entity (ldb/class?))
@@ -236,6 +236,9 @@
       (sdk-utils/result->js property')
       )))
 
+(defn remove-tag-class-property [tag-id property-id-or-name]
+  (throw (ex-info "TODO: implement remove-tag-class-property" {tag-id property-id-or-name})))
+
 (defn add-block-tag [id-or-name tag-id]
   (p/let [repo (state/get-current-repo)
           tag (db-async/<get-block repo tag-id)