diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 11d307ef120..c550628a097 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -4016,7 +4016,8 @@ *virtualized-ref (rum/use-ref nil) virtual-opts (when virtualized? {:ref *virtualized-ref - :custom-scroll-parent (gdom/getElement "main-content-container") + :custom-scroll-parent (or (:scroll-container config) + (gdom/getElement "main-content-container")) :compute-item-key (fn [idx] (let [block (nth blocks idx)] (str (:container-id config) "-" (:db/id block)))) @@ -4029,12 +4030,12 @@ bottom? (= (dec (count blocks)) idx) block (nth blocks idx)] (block-item (assoc config :top? top?) - block - {:top? top? - :bottom? bottom?})))}) + block + {:top? top? + :bottom? bottom?})))}) *wrap-ref (rum/use-ref nil)] (rum/use-effect! - (fn [] + (fn [] (when virtualized? (when (:current-page? config) (let [ref (.-current *virtualized-ref)] @@ -4170,10 +4171,8 @@ (and (:ref? config) (:group-by-page? config) (vector? (first blocks))) [:div.flex.flex-col.references-blocks-wrap (let [blocks (sort-by (comp :block/journal-day first) > blocks) - scroll-container (or - (when-let [*ref (:scroll-container config)] - (rum/deref *ref)) - (gdom/getElement "main-content-container"))] + scroll-container (or (:scroll-container config) + (gdom/getElement "main-content-container"))] (when (seq blocks) (if (:sidebar? config) (for [block blocks] diff --git a/src/main/frontend/components/reference.cljs b/src/main/frontend/components/reference.cljs index 05a8f9be4e1..6fc2db8ba43 100644 --- a/src/main/frontend/components/reference.cljs +++ b/src/main/frontend/components/reference.cljs @@ -49,7 +49,6 @@ [:div.references-blocks.faster.fade-in {:ref *ref} (let [ref-hiccup (block/->hiccup filtered-ref-blocks {:id (str (:block/uuid page-entity)) - :scroll-container *ref :ref? true :breadcrumb-show? true :group-by-page? true diff --git a/src/main/frontend/components/right_sidebar.cljs b/src/main/frontend/components/right_sidebar.cljs index 6ecec3649db..cfead54879e 100644 --- a/src/main/frontend/components/right_sidebar.cljs +++ b/src/main/frontend/components/right_sidebar.cljs @@ -41,11 +41,16 @@ :sidebar/idx idx :repo repo}))) +(defn get-scrollable-container + [] + (js/document.querySelector ".sidebar-item-list")) + (rum/defc page-cp < rum/reactive [repo page-name] (page/page-cp {:parameters {:path {:name page-name}} :sidebar? true - :repo repo})) + :scroll-container (get-scrollable-container) + :repo repo})) (rum/defc shortcut-settings []