enhance(zotero): put abstract note into a separate block

pull/2489/head
Tienson Qin 2021-08-01 11:59:18 +08:00
parent 53ae165f7c
commit 61131ba1eb
2 changed files with 16 additions and 4 deletions

View File

@ -43,6 +43,15 @@
(state/set-editor-show-zotero! false)
(editor-handler/insert-command! id (str "[[" page-name "]]") nil {}))
(defn- create-abstract-note!
[page-name abstract-note]
(when-not (str/blank? abstract-note)
(let [block (editor-handler/api-insert-new-block!
"[[Abstract]]" {:page page-name})]
(editor-handler/api-insert-new-block!
abstract-note {:block-uuid (:block/uuid block)
:sibling? false}))))
(defn create-zotero-page
([item]
(create-zotero-page item {}))
@ -50,8 +59,9 @@
:or {insert-command? true notification? true}
:as opt}]
(go
(let [{:keys [page-name properties]} (extractor/extract item)]
(let [{:keys [page-name properties]} (extractor/extract item)
abstract-note (get properties :abstract-note)
properties (dissoc properties :abstract-note)]
(when insert-command?
(handle-command-zotero block-dom-id page-name)
(editor-handler/save-current-block!))
@ -68,6 +78,8 @@
:create-first-block? false
:properties properties}))
(create-abstract-note! page-name abstract-note)
(<! (add page-name :attachments item))
(<! (add page-name :notes item))

View File

@ -7,9 +7,9 @@
(def default-settings
{:type :user
:include-attachments? true
:attachments-block-text "[[attachments]]"
:attachments-block-text "[[Attachments]]"
:include-notes? true
:notes-block-text "[[notes]]"
:notes-block-text "[[Notes]]"
:page-insert-prefix "@"})
(defn api-key []