feat(clock): add markdown support

pull/2747/head
leizhe 2021-08-30 20:36:43 +09:00 committed by Tienson Qin
parent be3dd3aa10
commit 80bfc4105e
2 changed files with 15 additions and 30 deletions

View File

@ -1846,19 +1846,6 @@
(when (and (= (:block/marker block) "DONE")
(state/enable-timetracking?))
(let [start-time (or
(get properties :now)
(get properties :doing)
(get properties :in-progress)
(get properties :later)
(get properties :todo))
finish-time (get properties :done)]
(when (and start-time finish-time (> finish-time start-time))
[:div.text-sm.time-spent.ml-1 {:title (str (date/int->local-time start-time) " ~ " (date/int->local-time finish-time))
:style {:padding-top 3}}
[:a.opacity-30.hover:opacity-100
(utils/timeConversion (- finish-time start-time))]]))
(let [summary (clock/clock-summary format content)]
(when summary
[:div.text-sm.time-spent.ml-1 {:title "org-clock-summary"

View File

@ -782,23 +782,21 @@
(if (state/enable-timetracking?)
(let [new-marker (string/lower-case new-marker)
old-marker (when old-marker (string/lower-case old-marker))]
(if (= :org format)
(when old-marker
(cond
(and (= old-marker "todo") (= new-marker "doing"))
(clock/clock-in format content)
(and (= old-marker "doing") (= new-marker "todo"))
(clock/clock-out format content)
(and (= old-marker "later") (= new-marker "now"))
(clock/clock-in format content)
(and (= old-marker "now") (= new-marker "later"))
(clock/clock-out format content)
(and (contains? #{"now" "doing"} old-marker)
(= new-marker "done"))
(clock/clock-out format content)
:else
content))
(property/insert-property format content new-marker (util/time-ms))))
(when old-marker
(cond
(and (= old-marker "todo") (= new-marker "doing"))
(clock/clock-in format content)
(and (= old-marker "doing") (= new-marker "todo"))
(clock/clock-out format content)
(and (= old-marker "later") (= new-marker "now"))
(clock/clock-in format content)
(and (= old-marker "now") (= new-marker "later"))
(clock/clock-out format content)
(and (contains? #{"now" "doing"} old-marker)
(= new-marker "done"))
(clock/clock-out format content)
:else
content)))
content))
(defn check