Explorar o código

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

close #2157
Tienson Qin %!s(int64=4) %!d(string=hai) anos
pai
achega
7ac785e7ed
Modificáronse 1 ficheiros con 6 adicións e 6 borrados
  1. 6 6
      src/main/frontend/handler/editor.cljs

+ 6 - 6
src/main/frontend/handler/editor.cljs

@@ -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)))