mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
refactor(editor): add nearest-scrollable-container util fn
This commit is contained in:
@@ -2226,11 +2226,12 @@
|
||||
(state/set-edit-content! (state/get-edit-input-id)
|
||||
(str s1 insertion))
|
||||
;; HACK: save scroll-pos of current pos, then add trailing content
|
||||
(let [scroll-pos (.-scrollTop (gdom/getElement "main-content-container"))]
|
||||
(let [scroll-container (util/nearest-scrollable-container input)
|
||||
scroll-pos (.-scrollTop scroll-container)]
|
||||
(state/set-edit-content! (state/get-edit-input-id)
|
||||
(str s1 insertion s2))
|
||||
(cursor/move-cursor-to input (+ selected-start (count insertion)))
|
||||
(set! (.-scrollTop (gdom/getElement "main-content-container")) scroll-pos))))))
|
||||
(set! (.-scrollTop scroll-container) scroll-pos))))))
|
||||
|
||||
(defn- keydown-new-line
|
||||
"Insert newline to current cursor position"
|
||||
|
||||
Reference in New Issue
Block a user