mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 14:39:48 +00:00
refactor(block): drop dead block-title-with-icon helper
block-title-with-icon had zero callers — the editor.cljs and property/value.cljs sites that used to compose via this helper were migrated to the explicit 20×20 icon-slot pattern (single icon per row, sourced from get-node-icon-cp), and CMD-K never composed through it. The only remaining references were explanatory comments documenting *why* the new pattern doesn't reuse it. Delete the function and rewrite the four comments to describe the de-dup rule directly (instance rows that diverge from a class default would otherwise render the same icon twice) rather than referencing a dead symbol that would rot future readers. Compile clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -117,14 +117,13 @@
|
||||
[:div.text-sm.pb-2.font-bold.text-gray-11 (highlight-query title)])
|
||||
[:div {:class "cp__cmdk-item-main-text text-sm font-medium text-gray-12 flex items-center gap-2 flex-wrap"}
|
||||
;; Title only — the icon is already rendered in the dedicated
|
||||
;; slot above (lines ~97-109) via the caller's `:icon` prop,
|
||||
;; which uses `get-node-icon-cp` to resolve own/inherited icons
|
||||
;; consistently. `block-title-with-icon` would have prepended
|
||||
;; another `(:logseq.property/icon source-block)` inline, which
|
||||
;; for blocks with their own icon override (e.g. an instance row
|
||||
;; that diverges from its class default) renders the same icon
|
||||
;; twice side-by-side. Inheriting rows hid the bug because the
|
||||
;; inline render is nil when the block has no own icon.
|
||||
;; slot above via the caller's `:icon` prop (`get-node-icon-cp`
|
||||
;; resolves own/inherited icons consistently). Prepending the
|
||||
;; block's own `:logseq.property/icon` inline next to the title
|
||||
;; would render the same icon twice for instance rows that
|
||||
;; diverge from their class default. Inheriting rows would mask
|
||||
;; the bug since the inline render is nil when the block has no
|
||||
;; own icon.
|
||||
(or (highlight-query text) (:block/title source-block))
|
||||
text-badge
|
||||
(when info
|
||||
|
||||
@@ -70,9 +70,9 @@
|
||||
(when-not db-tag?
|
||||
;; Single icon per row, same policy as CMD-K. `get-node-icon-cp`
|
||||
;; resolves the committed icon (own → tag default → type default),
|
||||
;; so the title text below can render alone — no need to inline
|
||||
;; another icon via `block-title-with-icon` (see cmdk/list_item.cljs:114-122
|
||||
;; for the de-dup rationale).
|
||||
;; so the title text below can render alone — see cmdk/list_item.cljs
|
||||
;; for the de-dup rationale (instance rows that diverge from a class
|
||||
;; default would otherwise render the same icon twice).
|
||||
;;
|
||||
;; Fixed `w-5 h-5` slot with `justify-center` so 14px tabler glyphs
|
||||
;; center within a 20px column matching the avatar tile width. All
|
||||
|
||||
@@ -1063,8 +1063,8 @@
|
||||
;; Single icon per row, same policy as CMD-K and the
|
||||
;; bracket popover. `get-node-icon-cp` resolves the
|
||||
;; committed icon (own → tag default → type default);
|
||||
;; the title renders alone below — no inline icon via
|
||||
;; `block-title-with-icon` (see cmdk/list_item.cljs:114-122).
|
||||
;; the title renders alone below (see cmdk/list_item.cljs
|
||||
;; for the de-dup rationale).
|
||||
;;
|
||||
;; Fixed 20×20 slot so all titles align regardless of
|
||||
;; icon type. Stays 20px even when the conditional
|
||||
@@ -1074,11 +1074,10 @@
|
||||
;; Class/property pickers intentionally render iconless
|
||||
;; (the entities being picked ARE classes/properties — a
|
||||
;; leading icon would just repeat the picker's own context).
|
||||
;; The `:logseq.property/classes` check used to be part of
|
||||
;; this guard, but only because the old title path inlined
|
||||
;; the icon via `block-title-with-icon`; with that path
|
||||
;; removed, entity-reference properties (Attendees,
|
||||
;; Collaborators, etc.) need the leading icon.
|
||||
;; Entity-reference properties (Attendees, Collaborators,
|
||||
;; etc.) keep the leading icon — the old title path used
|
||||
;; to inline it, but the iconless guard now covers only
|
||||
;; class/property to leave entity rows visible.
|
||||
(when-not (contains? #{:class :property} property-type)
|
||||
(icon-component/get-node-icon-cp node {}))]
|
||||
[:div title]]]
|
||||
|
||||
@@ -158,19 +158,6 @@
|
||||
(when alias
|
||||
(str " -> alias: " alias)))))))
|
||||
|
||||
(defn block-title-with-icon
|
||||
"Used for select item"
|
||||
[block title icon-cp]
|
||||
(if-let [icon (:logseq.property/icon block)]
|
||||
(let [photo? (contains? #{:avatar :image} (:type icon))
|
||||
icon-size (if photo? 20 16)]
|
||||
[:div.flex.flex-row.items-baseline.gap-2
|
||||
[:span.icon-inline.self-center.inline-flex.items-center.justify-center.flex-shrink-0
|
||||
{:style {:width 20 :height 20}}
|
||||
(icon-cp icon {:size icon-size :color? true})]
|
||||
title])
|
||||
(or title (:block/title block))))
|
||||
|
||||
(defn edit-block!
|
||||
[block pos & {:keys [_container-id custom-content tail-len save-code-editor?]
|
||||
:or {tail-len 0
|
||||
|
||||
Reference in New Issue
Block a user