Skip to content

Commit

Permalink
refactor: simplify clojure lang mode setting
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf authored and tiensonqin committed Dec 21, 2021
1 parent 9eb7c6f commit 0e570ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/main/frontend/components/file.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@
(and format (contains? (config/text-formats) format))
(when-let [file-content (db/get-file path)]
(let [content (string/trim file-content)
mode (util/get-file-ext path)
mode (if (contains? #{"edn" "clj" "cljc" "cljs" "clojure"} mode) "text/x-clojure" mode)]
mode (util/get-file-ext path)]
(lazy-editor/editor {:file? true
:file-path path} path {:data-lang mode} content {})))

Expand Down
5 changes: 1 addition & 4 deletions src/main/frontend/extensions/code.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,7 @@
(when-let [mode (:data-lang attr)]
(when-not (= mode "calc")
[:div.extensions__code-lang
(let [mode (string/lower-case mode)]
(if (= mode "text/x-clojure")
"clojure"
mode))]))
(string/lower-case mode)]))
[:textarea (merge {:id id
;; Expose the textarea associated with the CodeMirror instance via
;; ref so that we can autofocus into the CodeMirror instance later.
Expand Down

0 comments on commit 0e570ba

Please sign in to comment.