diff --git a/packages/client/src/components/wiki/tocs/tree.tsx b/packages/client/src/components/wiki/tocs/tree.tsx index c4ea03cd..559eeb5a 100644 --- a/packages/client/src/components/wiki/tocs/tree.tsx +++ b/packages/client/src/components/wiki/tocs/tree.tsx @@ -5,7 +5,8 @@ import { DocumentCreator as DocumenCreatorForm } from 'components/document/creat import { CREATE_DOCUMENT, event, triggerCreateDocument } from 'event'; import { useToggle } from 'hooks/use-toggle'; import Link from 'next/link'; -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; +import scrollIntoView from 'scroll-into-view-if-needed'; import styles from './index.module.scss'; @@ -64,14 +65,17 @@ const AddDocument = () => { ); }; +let scrollTimer; + export const Tree = ({ data, docAsLink, getDocLink, parentIds, activeId, isShareMode = false }) => { + const $container = useRef(null); const [expandedKeys, setExpandedKeys] = useState(parentIds); const renderBtn = useCallback((node) => , []); const renderLabel = useCallback( (label, item) => ( -
+