Sfoglia il codice sorgente

improve(api): the last active block also represent for current block

charlie 3 anni fa
parent
commit
a14b397899
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      src/main/logseq/api.cljs

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

@@ -545,7 +545,9 @@
 (def ^:export get_current_block
   (fn [^js opts]
     (let [block (state/get-edit-block)
-          block (or block (some-> (first (state/get-selection-blocks))
+          block (or block
+                    (some-> (or (first (state/get-selection-blocks))
+                                (gdom/getElement (state/get-editing-block-dom-id)))
                             (.getAttribute "blockid")
                             (db-model/get-block-by-uuid)))]
       (get_block (:db/id block) opts))))