Skip to content

Commit

Permalink
fix: remove duplicate commands map
Browse files Browse the repository at this point in the history
  • Loading branch information
thezjy authored and tiensonqin committed Jun 17, 2021
1 parent 9e3c197 commit d0fd7cf
Showing 1 changed file with 0 additions and 75 deletions.
75 changes: 0 additions & 75 deletions src/main/frontend/commands.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -108,81 +108,6 @@
(mapv (fn [level]
(let [heading (str "h" level)]
[heading (->heading (apply str (repeat level "#")))])) (range 1 7)))))
(defn commands-map
[get-page-ref-text]
(->>
(concat
(get-preferred-workflow)
[["DONE" (->marker "DONE")]
;; ["WAIT" (->marker "WAIT")]
;; ["IN-PROGRESS" (->marker "IN-PROGRESS")]
["A" (->priority "A")]
["B" (->priority "B")]
["C" (->priority "C")]
["Deadline" [[:editor/clear-current-slash]
[:editor/show-date-picker :deadline]]]
["Scheduled" [[:editor/clear-current-slash]
[:editor/show-date-picker :scheduled]]]
["Query" [[:editor/input "{{query }}" {:backward-pos 2}]]]
["Draw" (fn []
(let [file (draw/file-name)
path (str config/default-draw-directory "/" file)
text (util/format "[[%s]]" path)]
(p/let [_ (draw/create-draw-with-default-content path)]
(println "draw file created, " path))
text))]
["WAITING" (->marker "WAITING")]
["CANCELED" (->marker "CANCELED")]
["Tomorrow" #(get-page-ref-text (date/tomorrow))]
["Yesterday" #(get-page-ref-text (date/yesterday))]
["Today" #(get-page-ref-text (date/today))]
["Current Time" #(date/get-current-time)]
["Date Picker" [[:editor/show-date-picker]]]
["Page Reference" [[:editor/input "[[]]" {:backward-pos 2}]
[:editor/search-page]]]
["Page Embed" (embed-page)]
["Block Reference" [[:editor/input "(())" {:backward-pos 2}]
[:editor/search-block :reference]]]
["Block Embed" (embed-block)]
["Link" link-steps]
["Template" [[:editor/input "/" nil]
[:editor/search-template]]]
;; same as link
["Image Link" link-steps]
(cond
(and (util/electron?) (config/local-db? (state/get-current-repo)))

["Upload an asset (image, pdf, docx, etc.)" [[:editor/click-hidden-file-input :id]]]

(state/logged?)
["Upload an image" [[:editor/click-hidden-file-input :id]]])

(when (util/zh-CN-supported?)
["Embed Bilibili Video" [[:editor/input "{{bilibili }}" {:last-pattern slash
:backward-pos 2}]]])

["Embed Youtube Video" [[:editor/input "{{youtube }}" {:last-pattern slash
:backward-pos 2}]]]

["Embed Vimeo Video" [[:editor/input "{{vimeo }}" {:last-pattern slash
:backward-pos 2}]]]

(when (state/markdown?)
["Underline" [[:editor/input "<ins></ins>"
{:last-pattern slash
:backward-pos 6}]]])

["Html Inline " (->inline "html")]

;; TODO:
;; ["Upload a file" nil]
]
(markdown-headings)
;; Allow user to modify or extend, should specify how to extend.
(state/get-commands)
(state/get-plugins-commands))
(remove nil?)
(util/distinct-by-last-wins first)))

(defonce *matched-commands (atom nil))
(defonce *initial-commands (atom nil))
Expand Down

0 comments on commit d0fd7cf

Please sign in to comment.