fix(core): fix style break when scroll to block (#6001)

This commit is contained in:
EYHN
2024-03-04 11:43:10 +00:00
parent d935cf9d4d
commit a9be19ce6c
2 changed files with 9 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ export const mainContainerStyle = style({
width: 0,
display: 'flex',
flex: 1,
overflow: 'hidden',
maxWidth: '100%',
selectors: {
'&[data-show-padding="true"]': {

View File

@@ -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