Disable cycle todos for now

pull/10981/head
Tienson Qin 2024-01-24 01:58:40 +08:00
parent a64f49dc6f
commit b21322cdb2
2 changed files with 26 additions and 20 deletions

View File

@ -93,11 +93,12 @@
:on-click #(state/pub-event! [:editor/toggle-own-number-list (state/get-selection-block-ids)])}
(t :context-menu/toggle-number-list))
(ui/menu-link
{:key "cycle todos"
:on-click editor-handler/cycle-todos!
:shortcut (ui/keyboard-shortcut-from-config :editor/cycle-todo)}
(t :editor/cycle-todo))
(when-not (config/db-based-graph? (state/get-current-repo))
(ui/menu-link
{:key "cycle todos"
:on-click editor-handler/cycle-todos!
:shortcut (ui/keyboard-shortcut-from-config :editor/cycle-todo)}
(t :editor/cycle-todo)))
[:hr.menu-separator]

View File

@ -638,21 +638,25 @@
(defn cycle-todos!
[]
(when-let [blocks (seq (get-selected-blocks))]
(let [ids (->> (distinct (map #(when-let [id (dom/attr % "blockid")]
(uuid id)) blocks))
(remove nil?))]
(ui-outliner-tx/transact!
{:outliner-op :cycle-todos}
(doseq [id ids]
(let [block (db/pull [:block/uuid id])]
(when (not-empty (:block/content block))
(set-marker block))))))))
;; TODO: closed values needs to be enriched to know which state to be the next one
(when-not (config/db-based-graph? (state/get-current-repo))
(when-let [blocks (seq (get-selected-blocks))]
(let [ids (->> (distinct (map #(when-let [id (dom/attr % "blockid")]
(uuid id)) blocks))
(remove nil?))]
(ui-outliner-tx/transact!
{:outliner-op :cycle-todos}
(doseq [id ids]
(let [block (db/pull [:block/uuid id])]
(when (not-empty (:block/content block))
(set-marker block)))))))))
(defn cycle-todo!
[]
#_:clj-kondo/ignore
(when-not (state/get-editor-action)
(when (and (not (state/get-editor-action))
;; TODO: closed values needs to be enriched to know which state to be the next one
(not (config/db-based-graph? (state/get-current-repo))))
(if-let [blocks (seq (get-selected-blocks))]
(cycle-todos!)
(when (state/get-edit-block)
@ -669,10 +673,11 @@
(defn set-priority
[{:block/keys [priority content] :as block} new-priority]
(let [new-content (string/replace-first content
(util/format "[#%s]" priority)
(util/format "[#%s]" new-priority))]
(save-block-if-changed! block new-content)))
(when-not (config/db-based-graph? (state/get-current-repo))
(let [new-content (string/replace-first content
(util/format "[#%s]" priority)
(util/format "[#%s]" new-priority))]
(save-block-if-changed! block new-content))))
(defn delete-block-aux!
[{:block/keys [uuid repo] :as _block} children? & {:keys [_children-checks?] :as delete-opts}]