mirror of https://github.com/logseq/logseq
fix: esc to focus on date property value
parent
128d205832
commit
8845f3193b
|
@ -161,23 +161,33 @@
|
|||
(select-handler! d)))
|
||||
:on-select select-handler!}
|
||||
initial-month
|
||||
(assoc :default-month initial-month)))))]
|
||||
(assoc :default-month initial-month)))))
|
||||
open-popup! (fn [e]
|
||||
(util/stop e)
|
||||
(when-not config/publishing?
|
||||
(shui/popup-show! (.-target e) content-fn
|
||||
{:align "start" :auto-focus? true})))]
|
||||
(rum/use-effect!
|
||||
(fn []
|
||||
(when editing?
|
||||
(some-> (rum/deref *trigger-ref)
|
||||
(.click))))
|
||||
[])
|
||||
[:div.flex.flex-1.flex-row.gap-1.items-center.flex-wrap
|
||||
(cond-> {}
|
||||
(not multiple-values?)
|
||||
;; FIXME: min-h-6 not works
|
||||
(assoc :class "jtrigger min-h-[24px]"
|
||||
(if multiple-values?
|
||||
(shui/button
|
||||
{:class "jtrigger h-6 empty-btn"
|
||||
:ref *trigger-ref
|
||||
:on-click (fn [e]
|
||||
(when-not config/publishing?
|
||||
(shui/popup-show! (.-target e) content-fn
|
||||
{:align "start" :auto-focus? true})))))
|
||||
:variant :text
|
||||
:size :sm
|
||||
:on-click open-popup!}
|
||||
(ui/icon "calendar-plus" {:size 16}))
|
||||
(shui/trigger-as
|
||||
:div.flex.flex-1.flex-row.gap-1.items-center.flex-wrap
|
||||
{:tabIndex 0
|
||||
:class "jtrigger min-h-[24px]" ; FIXME: min-h-6 not works
|
||||
:ref *trigger-ref
|
||||
:on-click open-popup!}
|
||||
|
||||
(if page
|
||||
(when-let [page-cp (state/get-component :block/page-cp)]
|
||||
(rum/with-key
|
||||
|
@ -185,22 +195,7 @@
|
|||
:hide-close-button? true} page)
|
||||
(:db/id page)))
|
||||
(when-not multiple-values?
|
||||
(property-empty-btn-value)))
|
||||
|
||||
(when multiple-values?
|
||||
(shui/button
|
||||
{:class (str "jtrigger h-6" (when-not value " empty-btn"))
|
||||
:ref *trigger-ref
|
||||
:variant :text
|
||||
:size :sm
|
||||
:on-click (fn [e]
|
||||
(if config/publishing?
|
||||
(navigate-to-date-page value)
|
||||
(do
|
||||
(util/stop e)
|
||||
(shui/popup-show! (.-target e) content-fn
|
||||
{:align "start" :auto-focus? true}))))}
|
||||
(ui/icon "calendar-plus" {:size 16})))]))
|
||||
(property-empty-btn-value)))))))
|
||||
|
||||
|
||||
(rum/defc property-value-date-picker
|
||||
|
@ -814,13 +809,6 @@
|
|||
select-opts
|
||||
opts)
|
||||
(select block property select-opts opts))]))]
|
||||
;; why this?
|
||||
(rum/use-effect!
|
||||
(fn []
|
||||
(when editing?
|
||||
(prn "TODO: editing multiple select immediately show...")))
|
||||
[editing?])
|
||||
|
||||
(if (and dropdown? (not editing?))
|
||||
(let [toggle-fn shui/popup-hide!
|
||||
content-fn (fn [{:keys [_id content-props]}]
|
||||
|
|
Loading…
Reference in New Issue