fix(core): cannot scroll when dragging (#6070)

close TOV-671
This commit is contained in:
JimmFly
2024-03-12 05:43:47 +00:00
parent eca35ded2f
commit f832ada98c
4 changed files with 27 additions and 26 deletions

View File

@@ -8,7 +8,6 @@ import {
PageEditor,
} from '@blocksuite/presets';
import { type Doc } from '@blocksuite/store';
import clsx from 'clsx';
import React, {
forwardRef,
useCallback,
@@ -103,10 +102,7 @@ export const BlocksuiteDocEditor = forwardRef<
return (
<div className={styles.docEditorRoot}>
<div
className={clsx('affine-page-viewport', styles.affineDocViewport)}
data-doc-viewport={true}
>
<div className={styles.affineDocViewport}>
{!isJournal ? (
<adapted.DocTitle doc={page} ref={titleRef} />
) : (

View File

@@ -5,28 +5,10 @@ export const docEditorRoot = style({
background: cssVar('backgroundPrimaryColor'),
});
// brings styles of .affine-page-viewport from blocksuite
export const affineDocViewport = style({
display: 'flex',
flexDirection: 'column',
userSelect: 'none',
containerName: 'viewport',
// todo: find out what this does in bs
containerType: 'inline-size',
background: cssVar('backgroundPrimaryColor'),
'@media': {
print: {
display: 'none',
zIndex: -1,
},
},
selectors: {
'&[data-doc-viewport="true"]': {
overflowX: 'visible',
overflowY: 'visible',
height: 'auto',
},
},
paddingBottom: '150px',
});
export const docContainer = style({

View File

@@ -16,3 +16,19 @@ export const editorContainer = style({
flex: 1,
zIndex: 0,
});
// brings styles of .affine-page-viewport from blocksuite
export const affineDocViewport = style({
display: 'flex',
flexDirection: 'column',
userSelect: 'none',
containerName: 'viewport',
// todo: find out what this does in bs
containerType: 'inline-size',
background: cssVar('backgroundPrimaryColor'),
'@media': {
print: {
display: 'none',
zIndex: -1,
},
},
});

View File

@@ -22,6 +22,7 @@ import {
} from '@toeverything/infra';
import { Workspace } from '@toeverything/infra';
import { useService } from '@toeverything/infra';
import clsx from 'clsx';
import { useSetAtom } from 'jotai';
import {
memo,
@@ -198,9 +199,15 @@ const DetailPageImpl = memo(function DetailPageImpl() {
<div className={styles.mainContainer}>
{/* Add a key to force rerender when page changed, to avoid error boundary persisting. */}
<AffineErrorBoundary key={currentPageId}>
<TopTip pageId={currentPageId} workspace={currentWorkspace} />
<Scrollable.Root>
<Scrollable.Viewport className={styles.editorContainer}>
<TopTip pageId={currentPageId} workspace={currentWorkspace} />
<Scrollable.Viewport
className={clsx(
'affine-page-viewport',
styles.affineDocViewport,
styles.editorContainer
)}
>
<PageDetailEditor
pageId={currentPageId}
onLoad={onLoad}