enhance(ux): add highlights to unlinked references

This commit is contained in:
Tienson Qin
2026-01-05 18:22:01 +08:00
parent d1bbb5ad16
commit 1cf4fa9efd
2 changed files with 21 additions and 8 deletions

View File

@@ -49,6 +49,7 @@
[frontend.handler.property :as property-handler]
[frontend.handler.property.util :as pu]
[frontend.handler.route :as route-handler]
[frontend.handler.search :as search-handler]
[frontend.handler.ui :as ui-handler]
[frontend.mixins :as mixins]
[frontend.mobile.haptics :as haptics]
@@ -1544,10 +1545,21 @@
(hiccups.core/html)
(security/sanitize-html))))
(defn- highlight-query-text
[content query]
(if (and (string? content)
(not (string/blank? query))
(string/includes? (string/lower-case content)
(string/lower-case query)))
(search-handler/highlight-exact-query content query)
content))
(defn ^:large-vars/cleanup-todo inline
[{:keys [html-export?] :as config} item]
(match item
[(:or "Plain" "Spaces") s]
["Plain" s]
(highlight-query-text s (:highlight-query config))
["Spaces" s]
s
["Superscript" l]

View File

@@ -83,10 +83,11 @@
(set-has-references! result))))
[])
(when has-references?
[:div.unlinked-references
(views/view
{:view-parent entity
:view-feature-type :unlinked-references
:columns (views/build-columns config [] {})
:foldable-options {:default-collapsed? true}
:config config})]))))
(let [config (assoc config :highlight-query (:block/title entity))]
[:div.unlinked-references
(views/view
{:view-parent entity
:view-feature-type :unlinked-references
:columns (views/build-columns config [] {})
:foldable-options {:default-collapsed? true}
:config config})])))))