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

pull/962/head
Tienson Qin 2020-12-20 20:40:49 +08:00
parent 4cd2627892
commit c2b0576eb0
1 changed files with 3 additions and 1 deletions

View File

@ -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)