fix: slash command menu won't update to the setting language

This commit is contained in:
Mega Yu
2026-04-20 13:22:39 +08:00
parent b0fb33d80a
commit 632ec2f362
3 changed files with 12 additions and 8 deletions

View File

@@ -29,7 +29,8 @@
(defonce command-ask "\\")
(defonce *current-command (atom nil))
(def query-doc
(defn query-doc
[]
[:div {:on-pointer-down (fn [e] (.stopPropagation e))}
[:div.font-medium.text-lg.mb-2 (t :query/examples-title)]
[:ul.mb-1
@@ -41,7 +42,6 @@
[:li.mb-1 [:code "{{query (and (between -7d +7d) (task Done))}}"]]
[:li.mb-1 [:code "{{query (property key value)}}"]]
[:li.mb-1 [:code "{{query (tags #tag)}}"]]]
[:p
(interpolate-sentence
(t :query/examples-desc)
@@ -293,7 +293,7 @@
:icon/numberedChildren]]
;; advanced
[[(t :property.built-in/query) (query-steps) query-doc :icon/query (t :editor.slash/group-advanced)]
[[(t :property.built-in/query) (query-steps) (query-doc) :icon/query (t :editor.slash/group-advanced)]
[(t :editor.slash/advanced-query) (advanced-query-steps) (t :editor.slash/advanced-query-desc) :icon/query]
[(t :editor.slash/query-function) [[:editor/input "{{function }}" {:backward-pos 2}]] (t :editor.slash/query-function-desc) :icon/queryCode]
[(t :editor.slash/calculator)

View File

@@ -40,11 +40,14 @@
(defn filter-commands
[page? commands]
(if page?
(filter (fn [item]
(or
(= "Add new property" (first item))
(when (= (count item) 5)
(contains? #{"TASK STATUS" "TASK DATE" "PRIORITY"} (last item))))) commands)
(let [task-groups #{(t :editor.slash/group-task-status)
(t :editor.slash/group-task-date)
(t :editor.slash/group-priority)}]
(filter (fn [item]
(or
(= (t :command.editor/add-property) (first item))
(when (= (count item) 5)
(contains? task-groups (last item))))) commands))
commands))
(defn node-render

View File

@@ -314,6 +314,7 @@
(let [on-change (fn [e]
(let [lang-code (util/evalue e)]
(state/set-preferred-language! lang-code)
(state/pub-event! [:init/commands])
(ui-handler/re-render-root!)))
action [:select.form-select.is-small {:value preferred-language
:on-change on-change}