Fix issue of journal not changed after drag and drop

pull/645/head
Tienson Qin 2020-06-22 21:49:10 +08:00
parent aeea29adf1
commit b63712bbe4
3 changed files with 28 additions and 29 deletions

View File

@ -59,7 +59,7 @@
(if (and sidebar? (empty? raw-page-headings))
(do
(state/sidebar-remove-block! (:sidebar/idx option))
[:div "Deleted"])
[:div "Empty"])
(let [page-name (if heading?
(:page/name (db/entity repo (:db/id (:heading/page (first raw-page-headings)))))
page-name)

View File

@ -289,33 +289,32 @@
current-tag (get-current-tag)
current-page-id (get-current-page-id)
{:heading/keys [page]} (first headings)
handler-keys (when-let [page-id (:db/id page)]
(->>
(util/concat-without-nil
(map
(fn [heading]
[:headings (:heading/uuid heading)])
headings)
handler-keys (->>
(util/concat-without-nil
(mapcat
(fn [heading]
(let [page-id (:db/id (:heading/page heading))]
[[:headings (:heading/uuid heading)]
[:page/headings page-id]
[:page/ref-pages page-id]]))
headings)
;; affected tag
(when current-tag
[[:tag/ref-headings current-tag]])
;; affected tag
(when current-tag
[[:tag/ref-headings current-tag]])
;; affected page
[
[:page/headings page-id]
[:page/ref-pages page-id]
[:page/ref-pages current-page-id]
(when current-page-id
[[:page/ref-pages current-page-id]
[:page/refed-headings current-page-id]
[:page/mentioned-pages current-page-id]]
[:page/mentioned-pages current-page-id]])
;; refed-pages
(apply concat
(for [{:heading/keys [ref-pages]} headings]
(map (fn [page]
[:page/refed-headings (:db/id page)])
ref-pages))))
(distinct)))
;; refed-pages
(apply concat
(for [{:heading/keys [ref-pages]} headings]
(map (fn [page]
[:page/refed-headings (:db/id page)])
ref-pages))))
(distinct))
refed-pages (map
(fn [[k page-id]]
(if (= k :page/refed-headings)

View File

@ -1381,10 +1381,10 @@
{:key :heading/change
:data heading-changes}
[[path new-file-content]]))
;; (alter-file to-heading-repo
;; path
;; new-file-content
;; {:re-render-root? true})
(alter-file to-heading-repo
path
new-file-content
{:re-render-root? true})
))
;; same repo but different files
@ -1450,7 +1450,7 @@
to-after-headings
modified-time)
{:key :heading/change
:data (conj heading-changes to-heading)}
:data (conj heading-changes target-heading)}
[[target-file-path new-target-file-content]
[to-file-path new-to-file-content]])))