... | ... |
@@ -31,16 +31,15 @@ |
31 | 31 |
:else {:err (str "Unknown command '" cmdline "'")}))) |
32 | 32 |
|
33 | 33 |
(re-frame/reg-fx |
34 |
- :window/scroll-smoothly-to-bottom |
|
34 |
+ :window/scroll-to-prompt |
|
35 | 35 |
(fn [] |
36 |
- (let [x (.-scrollX js/window) |
|
37 |
- y (.-scrollMaxY js/window)] |
|
38 |
- (.scrollTo js/window (clj->js {:left x :top y :behavior :smooth}))))) |
|
36 |
+ (-> js/document |
|
37 |
+ (.getElementById "prompt") |
|
38 |
+ (.scrollIntoView (clj->js {:behavior :smooth}))))) |
|
39 | 39 |
|
40 | 40 |
(re-frame/reg-event-fx |
41 |
- ::scroll-to-bottom |
|
42 |
- (fn [] |
|
43 |
- {:window/scroll-smoothly-to-bottom []})) |
|
41 |
+ ::scroll-to-prompt |
|
42 |
+ (fn [] {:window/scroll-to-prompt []})) |
|
44 | 43 |
|
45 | 44 |
(re-frame/reg-event-fx |
46 | 45 |
::submit-cmd |
... | ... |
@@ -60,4 +59,4 @@ |
60 | 59 |
{:input cmdline :output output})))) |
61 | 60 |
; dispatch-later to ensure that the DOM has already been updated, |
62 | 61 |
; so that scrollMaxY has been changed appropriately. |
63 |
- :fx [[:dispatch-later {:ms 10 :dispatch [::scroll-to-bottom]}]]}))) |
|
62 |
+ :fx [[:dispatch-later {:ms 10 :dispatch [::scroll-to-prompt]}]]}))) |