Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

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

EYHNa9be19ce6c32
diff --git a/packages/frontend/component/src/components/workspace/index.css.ts b/packages/frontend/component/src/components/workspace/index.css.ts
index 720732ee53..cf3d0db37a 100644
--- a/packages/frontend/component/src/components/workspace/index.css.ts
+++ b/packages/frontend/component/src/components/workspace/index.css.ts
@@ -50,6 +50,7 @@ export const mainContainerStyle = style({
width: 0,
display: 'flex',
flex: 1,
+ overflow: 'hidden',
maxWidth: '100%',
selectors: {
'&[data-show-padding="true"]': {
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
index bfefdfcc2c..d4d9967fdf 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
@@ -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