mirror of https://github.com/logseq/logseq
After headings should be sorted by pos
parent
1d78d7bdcb
commit
cc6d3d9b87
|
@ -239,6 +239,12 @@
|
|||
(get-conn repo-url) path)
|
||||
seq-flatten))
|
||||
|
||||
(defn sort-by-pos
|
||||
[headings]
|
||||
(sort-by (fn [heading]
|
||||
(get-in heading [:heading/meta :pos]))
|
||||
headings))
|
||||
|
||||
(defn get-file-after-headings
|
||||
[repo-url file-id end-pos]
|
||||
(when end-pos
|
||||
|
@ -251,7 +257,8 @@
|
|||
[?heading :heading/meta ?meta]
|
||||
[(?pred $ ?meta)]]
|
||||
(get-conn repo-url) file-id pred)
|
||||
seq-flatten))))
|
||||
seq-flatten
|
||||
sort-by-pos))))
|
||||
|
||||
(defn delete-file-headings!
|
||||
[repo-url path]
|
||||
|
@ -322,12 +329,6 @@
|
|||
:git/error (get-key-value repo :git/error)})
|
||||
repos)))
|
||||
|
||||
(defn sort-by-pos
|
||||
[headings]
|
||||
(sort-by (fn [heading]
|
||||
(get-in heading [:heading/meta :pos]))
|
||||
headings))
|
||||
|
||||
(defn get-file-by-concat-headings
|
||||
([file]
|
||||
(get-file-by-concat-headings
|
||||
|
|
|
@ -163,7 +163,8 @@
|
|||
(fn [idx {:heading/keys [ref-pages meta] :as heading}]
|
||||
(let [heading (merge
|
||||
heading
|
||||
{:heading/file file
|
||||
{:heading/meta meta
|
||||
:heading/file file
|
||||
:heading/page page
|
||||
:heading/content (utf8/substring encoded-content
|
||||
(:pos meta)
|
||||
|
|
|
@ -722,6 +722,7 @@
|
|||
(db/transact!
|
||||
(concat
|
||||
pages
|
||||
[[:db.fn/retractEntity [:heading/uuid uuid]]]
|
||||
headings
|
||||
after-headings
|
||||
[{:file/path file-path
|
||||
|
|
Loading…
Reference in New Issue