fix: inline tags

pull/11433/head
Tienson Qin 2024-07-25 15:13:11 +08:00
parent 504b40f9bf
commit 4f368d5c79
2 changed files with 15 additions and 5 deletions

View File

@ -25,8 +25,13 @@
"Return the oldest page's db id for :block/title"
[db page-name]
{:pre [(string? page-name)]}
(first (sort (map :e
(d/datoms db :avet :block/title page-name)))))
(->> (d/datoms db :avet :block/title page-name)
(filter (fn [d]
(let [e (d/entity db (:e d))]
(or (sqlite-util/page? e) (:block/tags e)))))
(map :e)
sort
first))
(comment
(defn- get-built-in-files

View File

@ -771,7 +771,12 @@
(if (e/entity? page)
page
;; Use uuid when available to uniquely identify case sensitive contexts
(db/get-page (or (:block/uuid page) (:block/name page)))))))}
(db/get-page (or (:block/uuid page)
(let [s (string/trim (:block/name page))
s (if (string/starts-with? s db-content/page-ref-special-chars)
(common-util/safe-subs s 2)
s)]
s)))))))}
"Component for a page. `page` argument contains :block/name which can be (un)sanitized page name.
Keys for `config`:
- `:preview?`: Is this component under preview mode? (If true, `page-preview-trigger` won't be registered to this `page-cp`)"
@ -791,8 +796,8 @@
(if (ldb/page? entity)
(page-preview-trigger (assoc config :children inner) page-name)
(block-reference-preview inner {:repo (state/get-current-repo)
:config config
:id (:block/uuid entity)}))
:config config
:id (:block/uuid entity)}))
inner))
(block-reference config (:block/uuid entity) nil)))))