mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 12:06:35 +08:00
feature: 1.add primary ability in scroll scrollIntoViewByBlockId API;
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
@@ -168,12 +167,12 @@ export const TOC = () => {
|
||||
}, [updateTocDataSource]);
|
||||
|
||||
const onClick = async (blockId?: string) => {
|
||||
if (blockId === activeBlockId) {
|
||||
return;
|
||||
}
|
||||
|
||||
setActiveBlockId(blockId);
|
||||
await editor.scrollManager.scrollIntoViewByBlockId(blockId);
|
||||
await editor.scrollManager.scrollIntoViewByBlockId(
|
||||
blockId,
|
||||
'smooth',
|
||||
'primary'
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user