Przeglądaj źródła

fix: scroll to follow the moving block

Sebastian Bensusan 4 lat temu
rodzic
commit
3be517a3ea
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      src/main/frontend/handler/editor.cljs

+ 3 - 1
src/main/frontend/handler/editor.cljs

@@ -1693,7 +1693,9 @@
         (when-let [repo (state/get-current-repo)]
           (let [opts {:key :block/change
                       :data [block]}]
-            (db/refresh! repo opts)))))))
+            (db/refresh! repo opts)))
+        (when-let [block-node (util/get-first-block-by-id block-id)]
+          (.scrollIntoView block-node #js {:behavior "smooth" :block "center"}))))))
 
 ;; selections
 (defn on-tab