Explorar o código

平滑滚动到中间

visuddhinanda %!s(int64=2) %!d(string=hai) anos
pai
achega
7f21cf8458
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      dashboard/src/components/template/SentEdit/SentCell.tsx

+ 7 - 1
dashboard/src/components/template/SentEdit/SentCell.tsx

@@ -60,7 +60,13 @@ const SentCellWidget = ({
   useEffect(() => {
     if (anchorInfo && anchorInfo?.resId === initValue?.id) {
       const ele = document.getElementById(sid);
-      ele?.scrollIntoView();
+      if (ele !== null) {
+        ele.scrollIntoView({
+          behavior: "smooth",
+          block: "center",
+          inline: "nearest",
+        });
+      }
     }
   }, [anchorInfo, initValue?.id, sid]);