Browse Source

enhance(search): only show new file when ext matched

Tienson Qin 4 years ago
parent
commit
c2b0576eb0
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/main/frontend/components/search.cljs

+ 3 - 1
src/main/frontend/components/search.cljs

@@ -52,7 +52,9 @@
   [{:keys [pages files blocks]} search-q]
   (rum/with-context [[t] i18n/*tongue-context*]
     (let [new-page [{:type :new-page}]
-          new-file [{:type :new-file}]
+          new-file (when-let [ext (util/get-file-ext search-q)]
+                     (when (contains? config/mldoc-support-formats (keyword (string/lower-case ext)))
+                       [{:type :new-file}]))
           pages (map (fn [page] {:type :page :data page}) pages)
           files (map (fn [file] {:type :file :data file}) files)
           blocks (map (fn [block] {:type :block :data block}) blocks)