enhance(ux): set different hovering actions for tag, property

and page
This commit is contained in:
Tienson Qin
2025-05-22 02:08:04 +08:00
parent 0787d7ae36
commit ed0860fcc3
2 changed files with 26 additions and 7 deletions

View File

@@ -10,6 +10,7 @@
[frontend.components.file-based.hierarchy :as hierarchy]
[frontend.components.objects :as objects]
[frontend.components.plugins :as plugins]
[frontend.components.property.config :as property-config]
[frontend.components.query :as query]
[frontend.components.reference :as reference]
[frontend.components.scheduled-deadlines :as scheduled]
@@ -438,9 +439,24 @@
:size :sm
:class "px-2 py-0 h-6 text-xs text-muted-foreground"
:on-click (fn [e]
(state/pub-event! [:editor/new-property {:block page
:target (.-target e)}]))}
"Set property")]])
(if (ldb/property? page)
(shui/popup-show!
(.-target e)
(fn []
[:div.ls-property-dropdown
(property-config/property-dropdown page nil {})])
{:align :center})
(let [opts (cond-> {:block page :target (.-target e)}
(ldb/class? page)
(assoc :class-schema? true))]
(state/pub-event! [:editor/new-property opts]))))}
(cond
(ldb/class? page)
"Add tag property"
(ldb/property? page)
"Configure"
:else
"Set property"))]])
(rum/defc db-page-title
[page whiteboard-page? sidebar? container-id]
@@ -558,7 +574,7 @@
(shui/tabs
{:defaultValue default-tab
:class "w-full"}
(when (or both? property?)
(when both?
[:div.flex.flex-row.gap-1.items-center
(shui/tabs-list
{:class "h-8"}

View File

@@ -638,9 +638,12 @@
(into result cur-properties)
result)))
result))
full-properties (->> (concat block-own-properties'
(map (fn [p] [p (get block p)]) class-properties))
remove-built-in-or-other-position-properties)]
full-properties (cond->
(->> (concat block-own-properties'
(map (fn [p] [p (get block p)]) class-properties))
remove-built-in-or-other-position-properties)
(and (ldb/class? block) (empty? (:logseq.property.class/properties block)))
(concat [[:logseq.property.class/properties nil]]))]
(cond
(empty? full-properties)
(when sidebar-properties?