diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index a2d6132893..8ff79963e6 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -64,6 +64,7 @@ frontend.components.query.result query-result frontend.components.class class-component frontend.components.property property-component + frontend.components.title title frontend.common.date common-date frontend.common.file.core common-file frontend.common.file.util wfu diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 29198606ca..a9a6353544 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -90,7 +90,8 @@ [electron.ipc :as ipc] [frontend.db.async :as db-async] [logseq.db.frontend.content :as db-content] - [logseq.db :as ldb])) + [logseq.db :as ldb] + [frontend.components.title :as title])) ;; local state (defonce *dragging? @@ -546,7 +547,7 @@ page-name-in-block is the overridable name of the page (legacy) All page-names are sanitized except page-name-in-block" - [state {:keys [contents-page? whiteboard-page? html-export? meta-click?] :as config} page-entity children label] + [state {:keys [contents-page? whiteboard-page? html-export? meta-click? show-unique-title?] :as config} page-entity children label] (let [*hover? (::hover? state) *mouse-down? (::mouse-down? state) tag? (:tag? config) @@ -618,6 +619,9 @@ (coll? label) (->elem :span (map-inline config label)) + show-unique-title? + (title/block-unique-title page-entity) + :else (let [title (:block/title page-entity) s (cond untitled? diff --git a/src/main/frontend/components/property/value.cljs b/src/main/frontend/components/property/value.cljs index 4537d340f4..f33343e6be 100644 --- a/src/main/frontend/components/property/value.cljs +++ b/src/main/frontend/components/property/value.cljs @@ -27,7 +27,8 @@ [logseq.db.frontend.property.type :as db-property-type] [dommy.core :as d] [frontend.search :as search] - [goog.functions :refer [debounce]])) + [goog.functions :refer [debounce]] + [frontend.components.title :as title])) (rum/defc property-empty-btn-value [& {:as opts}] @@ -388,7 +389,7 @@ options (map (fn [node] (let [id (or (:value node) (:db/id node)) label (if (integer? id) - (let [title (subs (:block/title node) 0 256) + (let [title (subs (title/block-unique-title node) 0 256) node (or (db/entity id) node) icon (get-node-icon node)] [:div.flex.flex-row.items-center.gap-1 @@ -659,22 +660,23 @@ (shui/button {:variant :ghost :size :sm :class "px-0 py-0 h-4"} - (ui/icon "edit" {:size 14})))])] + (ui/icon "edit" {:size 14})))])] [:div.select-item.cursor-pointer (cond (= value :logseq.property/empty-placeholder) (property-empty-btn-value) (or (ldb/page? value) - (and (seq (:block/tags value)) - ;; FIXME: page-cp should be renamed to node-cp and - ;; support this case and maybe other complex cases. - (not (string/includes? (:block/title value) "[[")))) + (and (seq (:block/tags value)) + ;; FIXME: page-cp should be renamed to node-cp and + ;; support this case and maybe other complex cases. + (not (string/includes? (:block/title value) "[[")))) (when value (rum/with-key (page-cp {:disable-preview? true :tag? tag? :hide-close-button? true + :show-unique-title? true :meta-click? other-position?} value) (:db/id value)))