mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 09:26:28 +00:00
refactor: allow a block to have multiple types
For example, a whiteboard page can be used both as a property and a class.
This commit is contained in:
@@ -145,9 +145,9 @@
|
||||
;; TODO: performance improvement
|
||||
(defn- extract-pages-and-blocks
|
||||
"uri-encoded? - if is true, apply URL decode on the file path
|
||||
options -
|
||||
options -
|
||||
:extracted-block-ids - An atom that contains all block ids that have been extracted in the current page (not yet saved to db)
|
||||
:resolve-uuid-fn - Optional fn which is called to resolve uuids of each block. Enables diff-merge
|
||||
:resolve-uuid-fn - Optional fn which is called to resolve uuids of each block. Enables diff-merge
|
||||
(2 ways diff) based uuid resolution upon external editing.
|
||||
returns a list of the uuids, given the receiving ast, or nil if not able to resolve.
|
||||
Implemented in file-common-handler/diff-merge-uuids for IoC
|
||||
@@ -169,7 +169,7 @@
|
||||
(vec))
|
||||
ref-pages (atom #{})
|
||||
blocks (map (fn [block]
|
||||
(if (contains? #{"macro"} (:block/type block))
|
||||
(if (contains? (:block/type block) "macro")
|
||||
block
|
||||
(let [block-ref-pages (seq (:block/refs block))
|
||||
page-lookup-ref [:block/name page-name]
|
||||
|
||||
@@ -103,6 +103,6 @@
|
||||
page (first pages)]
|
||||
(is (= (get-in page [:block/file :file/path]) "/whiteboards/foo.edn"))
|
||||
(is (= (:block/name page) "foo"))
|
||||
(is (= (:block/type page) "whiteboard"))
|
||||
(is (true? (contains? (:block/type page) "whiteboard")))
|
||||
(is (= (:block/original-name page) "Foo"))
|
||||
(is (every? #(= (:block/parent %) {:block/name "foo"}) blocks))))
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
parent (:block/page (ffirst blocks))]
|
||||
(is (= {:block/name "foo"
|
||||
:block/original-name "Foo"
|
||||
:block/type "whiteboard"
|
||||
:block/type #{"whiteboard"}
|
||||
:block/file {:file/path "/whiteboards/foo.edn"}}
|
||||
parent)
|
||||
"parsed block in the whiteboard page has correct parent page"))))
|
||||
|
||||
Reference in New Issue
Block a user