Tienson Qin 2023-06-26 15:41:13 +08:00
parent 98fc900083
commit d73c51c41c
3 changed files with 10 additions and 4 deletions

View File

@ -425,7 +425,10 @@ independent of format as format specific heading characters are stripped"
{:query-fn (fn [_]
(let [e (db-utils/entity id)
children (map :db/id (sort-by-left (:block/_parent e) e))]
[e {:properties (:block/properties e)
[e {:content (:block/content e)
:marker (:block/marker e)
:priority (:block/priority e)
:properties (:block/properties e)
:children children
:collapsed? (:block/collapsed? e)}]))}
nil)

View File

@ -236,8 +236,9 @@
(defn- save-block-inner!
[block value opts]
(let [block (assoc block :block/content value)
block (apply dissoc block db-schema/retract-attributes)]
(let [block {:db/id (:db/id block)
:block/uuid (:block/uuid block)
:block/content value}]
(profile
"Save block: "
(let [original-uuid (:block/uuid (db/entity (:db/id block)))
@ -250,6 +251,7 @@
uuid-changed?
(assoc :uuid-changed {:from (:block/uuid block)
:to original-uuid})))]
(outliner-tx/transact!
opts'
(outliner-core/save-block! block'))

View File

@ -66,7 +66,8 @@
value))
(defn wrap-parse-block
[{:block/keys [content format left page uuid level pre-block?] :as block}]
[{:block/keys [content format left page uuid level pre-block?] :as block
:or {format :markdown}}]
(let [repo (state/get-current-repo)
block (or (and (:db/id block) (db/pull (:db/id block))) block)
block (merge block