Browse Source

fix: lint

charlie 4 months ago
parent
commit
d80be20c28
2 changed files with 13 additions and 15 deletions
  1. 13 14
      src/main/logseq/api.cljs
  2. 0 1
      src/main/logseq/sdk/utils.cljs

+ 13 - 14
src/main/logseq/api.cljs

@@ -717,7 +717,6 @@
 
 (defn ^:export insert_block
   [block-uuid-or-page-name content ^js opts]
-
   (this-as this
     (when (string/blank? block-uuid-or-page-name)
       (throw (js/Error. "Page title or block UUID shouldn't be empty.")))
@@ -768,7 +767,7 @@
                                            (merge properties
                                              (when custom-uuid {:id custom-uuid})))})
                 _ (when (and db-base? (some? properties))
-                    (api-block/save-db-based-block-properties! new-block properties))]
+                    (api-block/save-db-based-block-properties! new-block properties this))]
           (bean/->js (sdk-utils/normalize-keyword-for-json new-block)))))))
 
 (def ^:export insert_batch_block
@@ -945,18 +944,18 @@
 (defn ^:export upsert_block_property
   [block-uuid keyname ^js value]
   (this-as this
-           (p/let [keyname (api-block/sanitize-user-property-name keyname)
-                   block-uuid (sdk-utils/uuid-or-throw-error block-uuid)
-                   repo (state/get-current-repo)
-                   block (db-async/<get-block repo block-uuid :children? false)
-                   db-base? (db-graph?)
-                   key' (-> (if (keyword? keyname) (name keyname) keyname) (util/trim-safe))
-                   value (bean/->clj value)]
-             (when block
-               (if db-base?
-                 (p/do!
-                   (api-block/save-db-based-block-properties! block {key' value}))
-                 (property-handler/set-block-property! repo block-uuid key' value))))))
+    (p/let [keyname (api-block/sanitize-user-property-name keyname)
+            block-uuid (sdk-utils/uuid-or-throw-error block-uuid)
+            repo (state/get-current-repo)
+            block (db-async/<get-block repo block-uuid :children? false)
+            db-base? (db-graph?)
+            key' (-> (if (keyword? keyname) (name keyname) keyname) (util/trim-safe))
+            value (bean/->clj value)]
+      (when block
+        (if db-base?
+          (p/do!
+            (api-block/save-db-based-block-properties! block {key' value} this))
+          (property-handler/set-block-property! repo block-uuid key' value))))))
 
 (defn ^:export remove_block_property
   [block-uuid key]

+ 0 - 1
src/main/logseq/sdk/utils.cljs

@@ -3,7 +3,6 @@
             [camel-snake-kebab.core :as csk]
             [frontend.util :as util]
             [datascript.impl.entity :as de]
-            [frontend.db.utils :as db-utils]
             [goog.object :as gobj]
             [cljs-bean.core :as bean]))