瀏覽代碼

improve(plugin): more apis & types

charlie 4 年之前
父節點
當前提交
2cd0c5b3b8
共有 3 個文件被更改,包括 7 次插入1 次删除
  1. 1 0
      libs/src/LSPlugin.d.ts
  2. 1 0
      src/main/frontend/handler/route.cljs
  3. 5 1
      src/main/logseq/api.cljs

+ 1 - 0
libs/src/LSPlugin.d.ts

@@ -130,6 +130,7 @@ interface IEditorProxy {
   registerBlockContextMenu: (tag: string, action: BlockCommandCallback) => boolean
   registerBlockContextMenu: (tag: string, action: BlockCommandCallback) => boolean
 
 
   // block related APIs
   // block related APIs
+  getEditBlockContent: () => Promise<string>
   getCurrentPage: () => Promise<Partial<BlockEntity>>
   getCurrentPage: () => Promise<Partial<BlockEntity>>
   getCurrentBlock: () => Promise<BlockEntity>
   getCurrentBlock: () => Promise<BlockEntity>
   getCurrentPageBlocksTree: () => Promise<Array<BlockEntity>>
   getCurrentPageBlocksTree: () => Promise<Array<BlockEntity>>

+ 1 - 0
src/main/frontend/handler/route.cljs

@@ -93,6 +93,7 @@
   (let [route route]
   (let [route route]
     (swap! state/state assoc :route-match route)
     (swap! state/state assoc :route-match route)
     (update-page-title! route)
     (update-page-title! route)
+    (update-page-label! route)
     (if-let [anchor (get-in route [:query-params :anchor])]
     (if-let [anchor (get-in route [:query-params :anchor])]
       (jump-to-anchor! anchor)
       (jump-to-anchor! anchor)
       (util/scroll-to (util/app-scroll-container-node)
       (util/scroll-to (util/app-scroll-container-node)

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

@@ -158,6 +158,10 @@
           block (and block (db-utils/pull (:db/id block)))]
           block (and block (db-utils/pull (:db/id block)))]
       (bean/->js (normalize-keyword-for-json block)))))
       (bean/->js (normalize-keyword-for-json block)))))
 
 
+(def ^:export get_edit_block_content
+  (fn []
+    (state/get-edit-content)))
+
 (def ^:export get_current_page
 (def ^:export get_current_page
   (fn []
   (fn []
     (when-let [page (state/get-current-page)]
     (when-let [page (state/get-current-page)]
@@ -179,7 +183,7 @@
     (let [{:keys [includeChildren]} (bean/->clj opts)
     (let [{:keys [includeChildren]} (bean/->clj opts)
           repo (state/get-current-repo)]
           repo (state/get-current-repo)]
       (editor-handler/delete-block-aux!
       (editor-handler/delete-block-aux!
-       {:block/uuid (medley/uuid block-uuid) :repo repo} false includeChildren))))
+       {:block/uuid (medley/uuid block-uuid) :repo repo} includeChildren))))
 
 
 (def ^:export update_block
 (def ^:export update_block
   (fn [block-uuid content ^js opts]
   (fn [block-uuid content ^js opts]