mirror of https://github.com/logseq/logseq
enhance: new classes can be case sensitive
parent
94e6f78dc0
commit
c87c077d29
|
@ -302,7 +302,7 @@
|
|||
Useful when creating new pages from references or namespaces,
|
||||
as there's no chance to introduce timestamps via editing in page"
|
||||
[original-page-name with-id? db with-timestamp? date-formatter
|
||||
& {:keys [from-page]}]
|
||||
& {:keys [from-page class?]}]
|
||||
(let [db-based? (ldb/db-based-graph? db)]
|
||||
(cond
|
||||
(and original-page-name (string? original-page-name))
|
||||
|
@ -311,7 +311,10 @@
|
|||
namespace? (and (not db-based?)
|
||||
(not (boolean (text/get-nested-page-name original-page-name)))
|
||||
(text/namespace-page? original-page-name))
|
||||
page-entity (some-> db (ldb/get-page original-page-name))
|
||||
page-entity (when db
|
||||
(if class?
|
||||
(ldb/get-case-page db original-page-name)
|
||||
(ldb/get-page db original-page-name)))
|
||||
original-page-name (or from-page (:block/original-name page-entity) original-page-name)]
|
||||
(merge
|
||||
{:block/name page-name
|
||||
|
|
|
@ -188,12 +188,12 @@
|
|||
(let [page* (string/trim page)
|
||||
[_ page inline-class] (or (seq (map string/trim (re-find #"(.*)#(.*)$" page*)))
|
||||
[nil page* nil])
|
||||
id (:db/id (ldb/get-page (db/get-db) page))
|
||||
id (:db/id (ldb/get-case-page (db/get-db) page))
|
||||
class? (= :block/tags (:block/ident property))]
|
||||
(if (nil? id)
|
||||
(let [inline-class-uuid
|
||||
(when inline-class
|
||||
(or (:block/uuid (ldb/get-page (db/get-db) inline-class))
|
||||
(or (:block/uuid (ldb/get-case-page (db/get-db) inline-class))
|
||||
(do (log/error :msg "Given inline class does not exist" :inline-class inline-class)
|
||||
nil)))]
|
||||
(p/let [page (page-handler/<create! page {:redirect? false
|
||||
|
|
|
@ -323,14 +323,15 @@
|
|||
(p/do!
|
||||
(when db-based?
|
||||
(let [tag (string/trim chosen)
|
||||
edit-block (state/get-edit-block)]
|
||||
edit-block (state/get-edit-block)
|
||||
get-page-fn (if class? db/get-case-page db/get-page)]
|
||||
(when (and (not (string/blank? tag)) (:block/uuid edit-block))
|
||||
(p/let [tag-entity (db/get-page tag)
|
||||
(p/let [tag-entity (get-page-fn tag)
|
||||
_ (when-not tag-entity
|
||||
(<create! tag {:redirect? false
|
||||
:create-first-block? false
|
||||
:class? class?}))
|
||||
tag-entity (db/get-page tag)]
|
||||
tag-entity (get-page-fn tag)]
|
||||
(when class?
|
||||
(add-tag (state/get-current-repo) (:block/uuid edit-block) tag {:tag-entity tag-entity}))))))
|
||||
(editor-handler/insert-command! id
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
format (or format (common-config/get-preferred-format config))
|
||||
pages (map (fn [page]
|
||||
;; only apply uuid to the deepest hierarchy of page to create if provided.
|
||||
(-> (gp-block/page-name->map page (if (= page title) with-uuid? true) @conn true date-formatter)
|
||||
(-> (gp-block/page-name->map page (if (= page title) with-uuid? true) @conn true date-formatter :class? class?)
|
||||
(assoc :block/format format)))
|
||||
pages)
|
||||
txs (when-not db-based?
|
||||
|
|
Loading…
Reference in New Issue