fix: restore the commands after auto-complete date commands

Related to #686
This commit is contained in:
Tienson Qin
2020-11-18 23:01:11 +08:00
parent 86c2e460cf
commit 857e1d3df2
3 changed files with 11 additions and 7 deletions

View File

@@ -45,10 +45,12 @@
{:on-chosen (fn [chosen]
(reset! commands/*current-command chosen)
(let [command-steps (get (into {} matched) chosen)
restore-slash? (and
(not (fn? command-steps))
(not (contains? (set (map first command-steps)) :editor/input))
(not (contains? #{"Date Picker" "Template" "Deadline" "Scheduled"} chosen)))]
restore-slash? (or
(contains? #{"Today" "Yesterday" "Tomorrow"} chosen)
(and
(not (fn? command-steps))
(not (contains? (set (map first command-steps)) :editor/input))
(not (contains? #{"Date Picker" "Template" "Deadline" "Scheduled"} chosen))))]
(editor-handler/insert-command! id command-steps
format
{:restore? restore-slash?})))