fix: Marker keywords in bullet content change on ctrl+enter

close #2157
This commit is contained in:
Tienson Qin
2021-06-10 22:53:23 +08:00
parent 648e1ca1a2
commit 7ac785e7ed

View File

@@ -733,15 +733,15 @@
(util/starts-with? content "TODO")))
[new-content marker] (cond
(cond-fn "TODO")
[(string/replace-first content "TODO" "DOING") "DOING"]
[(string/replace-first content #"^TODO" "DOING") "DOING"]
(cond-fn "DOING")
[(string/replace-first content "DOING" "DONE") "DONE"]
[(string/replace-first content #"^DOING" "DONE") "DONE"]
(cond-fn "LATER")
[(string/replace-first content "LATER" "NOW") "NOW"]
[(string/replace-first content #"^LATER" "NOW") "NOW"]
(cond-fn "NOW")
[(string/replace-first content "NOW" "DONE") "DONE"]
[(string/replace-first content #"^NOW" "DONE") "DONE"]
(cond-fn "DONE")
[(string/replace-first content "DONE" "") nil]
[(string/replace-first content #"^DONE" "") nil]
:else
(let [marker (if (= :now (state/get-preferred-workflow))
"LATER"
@@ -755,7 +755,7 @@
(defn set-marker
[{:block/keys [uuid marker content format properties] :as block} new-marker]
(let [new-content (-> (string/replace-first content marker new-marker)
(let [new-content (-> (string/replace-first content (re-pattern (str "^" marker)) new-marker)
(with-marker-time format new-marker))]
(save-block-if-changed! block new-content)))