mirror of
https://github.com/logseq/logseq.git
synced 2026-04-25 22:54:48 +00:00
fix: can't paste headings
fixes https://github.com/logseq/db-test-cn/issues/7
This commit is contained in:
@@ -19,20 +19,30 @@ and handles unexpected failure."
|
||||
[blocks content format {:keys [page-name parse-block]}]
|
||||
(let [repo (state/get-current-repo)]
|
||||
(try
|
||||
(gp-block/extract-blocks blocks content format
|
||||
{:user-config (state/get-config)
|
||||
:parse-block parse-block
|
||||
:block-pattern (config/get-block-pattern format)
|
||||
:db (db/get-db repo)
|
||||
:date-formatter (state/get-date-formatter)
|
||||
:page-name page-name
|
||||
:db-graph-mode? (config/db-based-graph? repo)})
|
||||
(catch :default e
|
||||
(log/error :exception e)
|
||||
(state/pub-event! [:capture-error {:error e
|
||||
:payload {:type "Extract-blocks"}}])
|
||||
(notification/show! "An unexpected error occurred during block extraction." :error)
|
||||
[]))))
|
||||
(let [blocks (gp-block/extract-blocks blocks content format
|
||||
{:user-config (state/get-config)
|
||||
:parse-block parse-block
|
||||
:block-pattern (config/get-block-pattern format)
|
||||
:db (db/get-db repo)
|
||||
:date-formatter (state/get-date-formatter)
|
||||
:page-name page-name
|
||||
:db-graph-mode? (config/db-based-graph? repo)})]
|
||||
(if (config/db-based-graph? repo)
|
||||
(map (fn [block]
|
||||
(cond-> (dissoc block :block/properties)
|
||||
(:block/properties block)
|
||||
(merge (update-keys (:block/properties block)
|
||||
(fn [k]
|
||||
(or ({:heading :logseq.property/heading} k)
|
||||
(throw (ex-info (str "Don't know how to save graph-parser property " (pr-str k)) {}))))))))
|
||||
blocks)
|
||||
blocks))
|
||||
(catch :default e
|
||||
(log/error :exception e)
|
||||
(state/pub-event! [:capture-error {:error e
|
||||
:payload {:type "Extract-blocks"}}])
|
||||
(notification/show! "An unexpected error occurred during block extraction." :error)
|
||||
[]))))
|
||||
|
||||
(defn page-name->map
|
||||
"Wrapper around logseq.graph-parser.block/page-name->map that adds in db"
|
||||
|
||||
Reference in New Issue
Block a user