mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 19:02:23 +08:00
fix(core): fix style break when scroll to block (#6001)
This commit is contained in:
@@ -206,11 +206,13 @@ export const BlocksuiteEditorContainer = forwardRef<
|
||||
useEffect(() => {
|
||||
if (blockElement) {
|
||||
requestIdleCallback(() => {
|
||||
blockElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
inline: 'center',
|
||||
});
|
||||
if (mode === 'page') {
|
||||
blockElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
inline: 'center',
|
||||
});
|
||||
}
|
||||
const selectManager = affineEditorContainerProxy.host?.selection;
|
||||
if (!blockElement.path.length || !selectManager) {
|
||||
return;
|
||||
@@ -221,7 +223,7 @@ export const BlocksuiteEditorContainer = forwardRef<
|
||||
selectManager.set([newSelection]);
|
||||
});
|
||||
}
|
||||
}, [blockElement, affineEditorContainerProxy.host?.selection]);
|
||||
}, [blockElement, affineEditorContainerProxy.host?.selection, mode]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user