Browse Source

fix: preview card crash

rcmerci 4 years ago
parent
commit
78de8ce5bc
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/main/frontend/extensions/srs.cljs

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

@@ -398,10 +398,10 @@
   (rum/local 1 ::phase)
   (rum/local 1 ::phase)
   (rum/local 0 ::card-index)
   (rum/local 0 ::card-index)
   (rum/local {} ::review-records)
   (rum/local {} ::review-records)
-  [state cards {preview? :preview?
+  [state blocks {preview? :preview?
                 modal? :modal?
                 modal? :modal?
                 cb :callback}]
                 cb :callback}]
-  (let [cards (mapv ->card cards)
+  (let [cards (map ->card blocks)
         review-records (::review-records state)
         review-records (::review-records state)
         card-index (::card-index state)
         card-index (::card-index state)
         card (util/nth-safe cards @card-index)]
         card (util/nth-safe cards @card-index)]
@@ -479,12 +479,12 @@
 
 
 (rum/defc view-modal <
 (rum/defc view-modal <
   (shortcut/mixin :shortcut.handler/cards)
   (shortcut/mixin :shortcut.handler/cards)
-  [cards option]
-  (view cards option))
+  [blocks option]
+  (view blocks option))
 
 
 (defn preview
 (defn preview
   [blocks]
   [blocks]
-  (state/set-modal! #(view (mapv ->card blocks) {:preview? true})))
+  (state/set-modal! #(view blocks {:preview? true})))
 
 
 
 
 ;;; ================================================================
 ;;; ================================================================