浏览代码

fix(apis): types & incorrect property key for plugin caller

charlie 4 月之前
父节点
当前提交
89c5e61daf
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 4 4
      libs/src/LSPlugin.ts
  2. 1 1
      src/main/logseq/api/block.cljs

+ 4 - 4
libs/src/LSPlugin.ts

@@ -191,14 +191,14 @@ export interface BlockEntity {
   parent: IEntityID
   title: string
   content?: string // @deprecated. Use :title instead!
-  page: IEntityID
+  page: IEntityID // owner page
   createdAt: number
   updatedAt: number
+  ident?: string // ident for property block
   properties?: Record<string, any>
   'collapsed?': boolean
 
   // optional fields in dummy page
-  left?: IEntityID
   anchor?: string
   body?: any
   children?: Array<BlockEntity | BlockUUIDTuple>
@@ -812,7 +812,7 @@ export interface IEditorProxy extends Record<string, any> {
   upsertProperty: (
     key: string,
     schema?: Partial<{
-      type: 'default' | 'map' | 'number' | 'keyword' | 'node' | 'date' | 'checkbox' | string,
+      type: 'default' | 'number' | 'node' | 'date' | 'checkbox' | 'url' | string,
       cardinality: 'many' | 'one',
       hide: boolean
       public: boolean
@@ -831,7 +831,7 @@ export interface IEditorProxy extends Record<string, any> {
 
   removeBlockProperty: (block: BlockIdentity, key: string) => Promise<void>
 
-  getBlockProperty: (block: BlockIdentity, key: string) => Promise<BlockEntity | string | null>
+  getBlockProperty: (block: BlockIdentity, key: string) => Promise<BlockEntity | unknown>
 
   getBlockProperties: (block: BlockIdentity) => Promise<Record<string, any> | null>
 

+ 1 - 1
src/main/logseq/api/block.cljs

@@ -46,7 +46,7 @@
 (defn resolve-property-prefix-for-db
   [^js plugin]
   (when (some-> js/window.LSPlugin (.-PluginLocal))
-    (or (some-> plugin (.-id) (sanitize-user-property-name) (str "."))
+    (or (some->> plugin (.-id) (sanitize-user-property-name) (str "."))
       "._api")))
 
 ;; FIXME: This ns should not be creating idents. This allows for ident conflicts