浏览代码

fix: preview card

close #4542
Tienson Qin 3 年之前
父节点
当前提交
8cb6d26465
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 1 1
      src/main/frontend/extensions/srs.cljs
  2. 4 0
      src/main/frontend/util.cljc

+ 1 - 1
src/main/frontend/extensions/srs.cljs

@@ -498,7 +498,7 @@
   rum/reactive
   rum/reactive
   db-mixins/query
   db-mixins/query
   [blocks option card-index]
   [blocks option card-index]
-  (let [option (update option :random-mode? (fn [v] (if (boolean? v) v @v)))
+  (let [option (update option :random-mode? (fn [v] (if (util/atom? v) @v v)))
         blocks (if (fn? blocks) (blocks) blocks)
         blocks (if (fn? blocks) (blocks) blocks)
         blocks (if (:random-mode? option)
         blocks (if (:random-mode? option)
                  (shuffle blocks)
                  (shuffle blocks)

+ 4 - 0
src/main/frontend/util.cljc

@@ -1456,3 +1456,7 @@
 (defn collapsed?
 (defn collapsed?
   [block]
   [block]
   (:block/collapsed? block))
   (:block/collapsed? block))
+
+#?(:cljs
+   (defn atom? [v]
+     (instance? Atom v)))