Browse Source

feat: add data-refs-self for css mods

Tienson Qin 4 years ago
parent
commit
2ad2cd00f4
1 changed files with 20 additions and 14 deletions
  1. 20 14
      src/main/frontend/components/block.cljs

+ 20 - 14
src/main/frontend/components/block.cljs

@@ -1495,23 +1495,29 @@
                                (when doc-mode?
                                (when doc-mode?
                                  (when-let [parent (gdom/getElement block-id)]
                                  (when-let [parent (gdom/getElement block-id)]
                                    (when-let [node (.querySelector parent ".bullet-container")]
                                    (when-let [node (.querySelector parent ".bullet-container")]
-                                     (d/add-class! node "hide-inner-bullet")))))}]
-    [:div.ls-block.flex.flex-col.rounded-sm
-     (cond->
-      {:id block-id
-       :data-refs (let [refs (model/get-page-names-by-ids
+                                     (d/add-class! node "hide-inner-bullet")))))}
+        data-refs (let [refs (model/get-page-names-by-ids
                               (->> (map :db/id refs-with-children)
                               (->> (map :db/id refs-with-children)
                                    (remove nil?)))]
                                    (remove nil?)))]
                     (text/build-data-value refs))
                     (text/build-data-value refs))
-       :style {:position "relative"}
-       :class (str uuid
-                   (when dummy? " dummy")
-                   (when (and collapsed? has-child?) " collapsed")
-                   (when pre-block? " pre-block"))
-       :blockid (str uuid)
-       :repo repo
-       :level level
-       :haschild (str has-child?)}
+        data-refs-self (let [refs  (model/get-page-names-by-ids
+                                    (->> (map :db/id (:block/ref-pages block))
+                                         (remove nil?)))]
+                         (text/build-data-value refs))]
+    [:div.ls-block.flex.flex-col.rounded-sm
+     (cond->
+         {:id block-id
+          :data-refs data-refs
+          :data-refs-self data-refs-self
+          :style {:position "relative"}
+          :class (str uuid
+                      (when dummy? " dummy")
+                      (when (and collapsed? has-child?) " collapsed")
+                      (when pre-block? " pre-block"))
+          :blockid (str uuid)
+          :repo repo
+          :level level
+          :haschild (str has-child?)}
        (not slide?)
        (not slide?)
        (merge attrs))
        (merge attrs))