fix: user custom commands not working

This commit is contained in:
Tienson Qin
2020-11-19 15:22:54 +08:00
parent e22ba14e64
commit 0a92889258
4 changed files with 11 additions and 8 deletions

View File

@@ -132,7 +132,7 @@
;; ["Upload a file" nil]
]
;; Allow user to modify or extend, should specify how to extend.
(get-in @state/state [:config (state/get-current-repo) :commands]))
(state/get-commands))
(remove nil?)
(util/distinct-by-last-wins first)))
@@ -194,7 +194,7 @@
["Comment" (->block "comment")]]
;; Allow user to modify or extend, should specify how to extend.
(get-in @state/state [:config (state/get-current-repo) :block-commands]))
(state/get-commands))
(remove nil?)
(util/distinct-by-last-wins first)))

View File

@@ -49,6 +49,7 @@
(not (seq (db/get-files config/local-repo))))
(repo-handler/setup-local-repo-if-not-exists!)
(state/set-db-restoring! false))
(page-handler/init-commands!)
(if (seq (:repos me))
;; FIXME: handle error
(repo-handler/request-app-tokens!
@@ -131,8 +132,6 @@
(notification/show! "Sorry, it seems that your browser doesn't support IndexedDB, we recommend to use latest Chrome(Chromium) or Firefox(Non-private mode)." :error false)
(state/set-indexedb-support! false)))
(page-handler/init-commands!)
(restore-and-setup! me repos logged?)
(periodically-persist-repo-to-indexeddb!)

View File

@@ -1361,10 +1361,6 @@
:or {restore? true}
:as option}]
(cond
(fn? command-output)
(let [s (command-output)]
(commands/insert! id s option))
;; replace string
(string? command-output)
(commands/insert! id command-output option)
@@ -1373,6 +1369,10 @@
(vector? command-output)
(commands/handle-steps command-output format)
(fn? command-output)
(let [s (command-output)]
(commands/insert! id s option))
:else
nil)

View File

@@ -863,6 +863,10 @@
[]
(:network/online? @state))
(defn get-commands
[]
(:commands (get-config)))
(defonce editor-op (atom nil))
(defn set-editor-op!
[value]