瀏覽代碼

fix: simplify code

ksqsf 3 年之前
父節點
當前提交
138504df05
共有 1 個文件被更改,包括 4 次插入6 次删除
  1. 4 6
      src/main/frontend/extensions/srs.cljs

+ 4 - 6
src/main/frontend/extensions/srs.cljs

@@ -544,9 +544,7 @@
       [content nil]
       (let [cue (string/trim (last parts))]
         ;; If there are more than one separator, only the last component is considered the cue.
-        (if (string/blank? cue)
-          [(string/trimr (string/join cloze-cue-separator (drop-last parts))) nil]
-          [(string/trimr (string/join cloze-cue-separator (drop-last parts))) cue])))))
+        [(string/trimr (string/join cloze-cue-separator (drop-last parts))) cue]))))
 
 (rum/defcs cloze-macro-show < rum/reactive
   {:init (fn [state]
@@ -563,9 +561,9 @@
       [:a.cloze-revealed {:on-click toggle!}
        (util/format "[%s]" answer)]
       [:a.cloze {:on-click toggle!}
-       (if cue
-         (str "(" cue ")")
-         "[...]")])))
+       (if (string/blank? cue)
+         "[...]"
+         (str "(" cue ")"))])))
 
 (component-macro/register cloze-macro-name cloze-macro-show)