mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 19:36:35 +00:00
fix(editor): allow up/down arrows for repeater time selection
This commit is contained in:
@@ -179,10 +179,10 @@
|
||||
(constantly true))]
|
||||
(merge attributes {:selectable-fn selectable-fn})))
|
||||
|
||||
(defn- in-time-input?
|
||||
(defn- input-or-select?
|
||||
[]
|
||||
(when-let [elem js/document.activeElement]
|
||||
(= "time" (gobj/get elem "id"))))
|
||||
(or (util/input? elem) (util/select? elem))))
|
||||
|
||||
(rum/defc date-picker < rum/reactive
|
||||
(mixins/event-mixin
|
||||
@@ -192,28 +192,31 @@
|
||||
state
|
||||
{;; enter, current day
|
||||
13 (fn [state e]
|
||||
(when on-change
|
||||
(when (and on-change
|
||||
(not (input-or-select?)))
|
||||
(when-not deadline-or-schedule?
|
||||
(on-change e @*internal-model))))
|
||||
|
||||
;; left, previous day
|
||||
37 (fn [state e]
|
||||
(when-not (in-time-input?)
|
||||
(when-not (input-or-select?)
|
||||
(swap! *internal-model inc-date -1)))
|
||||
|
||||
;; right, next day
|
||||
39 (fn [state e]
|
||||
(when-not (in-time-input?)
|
||||
(when-not (input-or-select?)
|
||||
(swap! *internal-model inc-date 1)))
|
||||
|
||||
;; up, one week ago
|
||||
38 (fn [state e]
|
||||
(swap! *internal-model inc-week -1))
|
||||
(when-not (input-or-select?)
|
||||
(swap! *internal-model inc-week -1)))
|
||||
;; down, next week
|
||||
40 (fn [state e]
|
||||
(swap! *internal-model inc-week 1))}
|
||||
(when-not (input-or-select?)
|
||||
(swap! *internal-model inc-week 1)))}
|
||||
{:all-handler (fn [e key-code]
|
||||
(when (contains? #{13 38 40} key-code)
|
||||
(when (contains? #{13} key-code)
|
||||
(util/stop e)))}))))
|
||||
{:init (fn [state]
|
||||
(reset! *internal-model (first (:rum/args state)))
|
||||
|
||||
Reference in New Issue
Block a user