mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance: display parent page when referencing a page
This commit is contained in:
@@ -663,8 +663,9 @@
|
||||
All page-names are sanitized except page-name-in-block"
|
||||
[state
|
||||
{:keys [contents-page? whiteboard-page? other-position? show-unique-title? stop-click-event?
|
||||
on-context-menu]
|
||||
:or {stop-click-event? true}
|
||||
on-context-menu with-parent?]
|
||||
:or {stop-click-event? true
|
||||
with-parent? true}
|
||||
:as config}
|
||||
page-entity children label]
|
||||
(let [*hover? (::hover? state)
|
||||
@@ -732,6 +733,11 @@
|
||||
:own-icon? true})]
|
||||
[:span {:class (str "icon-emoji-wrap " (when emoji? "as-emoji"))}
|
||||
icon])))
|
||||
|
||||
(when (and (ldb/page? page-entity) with-parent?)
|
||||
(when-let [parent (:block/parent page-entity)]
|
||||
[:span.select-none (str (:block/title parent) "/")]))
|
||||
|
||||
[:span
|
||||
(if (and (coll? children) (seq children))
|
||||
(for [child children]
|
||||
@@ -3239,7 +3245,8 @@
|
||||
(let [parents-props (doall
|
||||
(for [{:block/keys [uuid name title] :as block} parents]
|
||||
(if name
|
||||
[block (page-cp {:disable-preview? true} block) true]
|
||||
[block (page-cp {:disable-preview? true
|
||||
:with-parent? false} block) true]
|
||||
(let [result (block/parse-title-and-body
|
||||
uuid
|
||||
(get block :block/format :markdown)
|
||||
|
||||
@@ -354,6 +354,9 @@
|
||||
(gobj/get range "endContainer")
|
||||
(gobj/get range "endOffset"))
|
||||
(let [contents (.cloneContents pre-caret-range)
|
||||
;; Remove all `.select-none` nodes
|
||||
_ (doseq [el (.querySelectorAll contents ".select-none")]
|
||||
(.remove el))
|
||||
html (some-> (first (.-childNodes contents))
|
||||
(gobj/get "innerHTML")
|
||||
str)
|
||||
@@ -365,7 +368,7 @@
|
||||
(string/ends-with? html "<div class=\"is-paragraph\"></div></div></span></div></div></div>")
|
||||
;; multiple lines with a new line
|
||||
(string/ends-with? html "<br></div></div></span></div></div></div>")))
|
||||
value (.toString pre-caret-range)]
|
||||
value (.-textContent contents)]
|
||||
(if br-ended?
|
||||
(str value "\n")
|
||||
value)))))
|
||||
|
||||
Reference in New Issue
Block a user