Просмотр исходного кода

enhance(quick-capture): add date as template variable

Andelf 3 лет назад
Родитель
Сommit
7e4698315d
2 измененных файлов с 4 добавлено и 1 удалено
  1. 2 0
      src/main/frontend/quick_capture.cljs
  2. 2 1
      templates/config.edn

+ 2 - 0
src/main/frontend/quick_capture.cljs

@@ -68,8 +68,10 @@
         template (get-in (state/get-config)
                          [:quick-capture-templates :text]
                          "**{time}** [[quick capture]]: {text} {url}")
+        date-ref-name (date/today)
         content (-> template
                     (string/replace "{time}" time)
+                    (string/replace "{date}" date-ref-name)
                     (string/replace "{url}" link)
                     (string/replace "{text}" text))
         edit-content (state/get-edit-content)

+ 2 - 1
templates/config.edn

@@ -300,6 +300,7 @@
  ;; Each template contains three elements {time}, {text} and {url}, which can be auto-expanded
  ;; by received contents from other apps. Note: the {} cannot be omitted.
  ;; - {time}: capture time
+ ;; - {date}: capture date using current date format, use `[[{date}]]` to get a page reference
  ;; - {text}: text that users selected before sharing.
  ;; - {url}: url or assets path for media files stored in Logseq.
  ;; You can also reorder them, or even only use one or two of them in the template.
@@ -309,7 +310,7 @@
  ;;  :media "[[quick capture]] **{time}**: {url}"}
 
  ;; Quick capture options
- ;; :quick-capture-options {:insert-today? false :redirect-page? false}
+ ;; :quick-capture-options {:insert-today? false :redirect-page? false :default-page nil}
 
  ;; File sync options
  ;; Ignore these files when syncing, regexp is supported.