fix(core): can not scroll when backlink list is too long (#8370)

close AF-1431
This commit is contained in:
JimmFly
2024-09-25 04:28:09 +00:00
parent 4daa959894
commit 45f5c89cd8
2 changed files with 31 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
import { cssVar } from '@toeverything/theme'; import { cssVar } from '@toeverything/theme';
import { cssVarV2 } from '@toeverything/theme/v2';
import { createVar, globalStyle, style } from '@vanilla-extract/css'; import { createVar, globalStyle, style } from '@vanilla-extract/css';
const propertyNameCellWidth = createVar(); const propertyNameCellWidth = createVar();
@@ -50,7 +51,7 @@ export const tableHeaderInfoRow = style({
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
color: cssVar('textSecondaryColor'), color: cssVarV2('text/secondary'),
fontSize: fontSize, fontSize: fontSize,
fontWeight: 500, fontWeight: 500,
minHeight: 34, minHeight: 34,
@@ -86,7 +87,7 @@ export const tableHeaderCollapseButtonWrapper = style({
}); });
export const pageInfoDimmed = style({ export const pageInfoDimmed = style({
color: cssVar('textSecondaryColor'), color: cssVarV2('text/secondary'),
}); });
export const spacer = style({ export const spacer = style({
@@ -98,7 +99,7 @@ export const tableHeaderBacklinksHint = style({
cursor: 'pointer', cursor: 'pointer',
borderRadius: '4px', borderRadius: '4px',
':hover': { ':hover': {
backgroundColor: cssVar('hoverColor'), backgroundColor: cssVarV2('layer/background/hoverOverlay'),
}, },
}); });
@@ -120,7 +121,7 @@ export const tableHeaderTimestamp = style({
export const tableHeaderDivider = style({ export const tableHeaderDivider = style({
height: 0, height: 0,
borderTop: `0.5px solid ${cssVar('borderColor')}`, borderTop: `0.5px solid ${cssVarV2('layer/insideBorder/border')}`,
width: '100%', width: '100%',
margin: '8px 0', margin: '8px 0',
'@media': { '@media': {
@@ -155,7 +156,7 @@ export const tableBodySortable = style({
export const addPropertyButton = style({ export const addPropertyButton = style({
alignSelf: 'flex-start', alignSelf: 'flex-start',
fontSize: cssVar('fontSm'), fontSize: cssVar('fontSm'),
color: `${cssVar('textSecondaryColor')}`, color: `${cssVarV2('text/secondary')}`,
padding: '0 4px', padding: '0 4px',
height: 36, height: 36,
fontWeight: 400, fontWeight: 400,
@@ -168,10 +169,10 @@ export const addPropertyButton = style({
}); });
globalStyle(`${addPropertyButton} svg`, { globalStyle(`${addPropertyButton} svg`, {
fontSize: 16, fontSize: 16,
color: cssVar('iconSecondary'), color: cssVarV2('icon/secondary'),
}); });
globalStyle(`${addPropertyButton}:hover svg`, { globalStyle(`${addPropertyButton}:hover svg`, {
color: cssVar('iconColor'), color: cssVarV2('icon/primary'),
}); });
export const collapsedIcon = style({ export const collapsedIcon = style({
@@ -190,7 +191,7 @@ export const propertyRow = style({
position: 'relative', position: 'relative',
selectors: { selectors: {
'&[data-dragging=true]': { '&[data-dragging=true]': {
backgroundColor: cssVar('hoverColor'), backgroundColor: cssVarV2('layer/background/hoverOverlay'),
borderTopLeftRadius: 0, borderTopLeftRadius: 0,
borderBottomLeftRadius: 0, borderBottomLeftRadius: 0,
}, },
@@ -213,7 +214,7 @@ export const draggableItem = style({
position: 'absolute', position: 'absolute',
top: '50%', top: '50%',
borderRadius: '2px', borderRadius: '2px',
backgroundColor: cssVar('placeholderColor'), backgroundColor: cssVarV2('text/placeholder'),
transform: 'translate(-12px, -50%)', transform: 'translate(-12px, -50%)',
transition: 'all 0.2s 0.1s', transition: 'all 0.2s 0.1s',
opacity: 0, opacity: 0,
@@ -278,7 +279,7 @@ export const editablePropertyRowCell = style([
{ {
cursor: 'pointer', cursor: 'pointer',
':hover': { ':hover': {
backgroundColor: cssVar('hoverColor'), backgroundColor: cssVarV2('layer/background/hoverOverlay'),
}, },
}, },
]); ]);
@@ -288,7 +289,7 @@ export const propertyRowNameCell = style([
{ {
padding: `6px ${rowHPadding}`, padding: `6px ${rowHPadding}`,
flexShrink: 0, flexShrink: 0,
color: cssVar('textSecondaryColor'), color: cssVarV2('text/secondary'),
width: propertyNameCellWidth, width: propertyNameCellWidth,
gap: 6, gap: 6,
}, },
@@ -306,7 +307,7 @@ export const propertyRowIconContainer = style({
justifyContent: 'center', justifyContent: 'center',
borderRadius: '2px', borderRadius: '2px',
fontSize: 16, fontSize: 16,
color: cssVar('iconSecondary'), color: cssVarV2('icon/secondary'),
}); });
export const propertyRowNameContainer = style({ export const propertyRowNameContainer = style({
@@ -330,16 +331,16 @@ export const propertyRowValueCell = style([
editablePropertyRowCell, editablePropertyRowCell,
{ {
border: `1px solid transparent`, border: `1px solid transparent`,
color: cssVar('textPrimaryColor'), color: cssVarV2('text/primary'),
':focus': { ':focus': {
backgroundColor: cssVar('hoverColor'), backgroundColor: cssVarV2('layer/background/hoverOverlay'),
}, },
'::placeholder': { '::placeholder': {
color: cssVar('placeholderColor'), color: cssVarV2('text/placeholder'),
}, },
selectors: { selectors: {
'&[data-empty="true"]': { '&[data-empty="true"]': {
color: cssVar('placeholderColor'), color: cssVarV2('text/placeholder'),
}, },
'&[data-readonly=true]': { '&[data-readonly=true]': {
pointerEvents: 'none', pointerEvents: 'none',
@@ -412,7 +413,7 @@ export const menuHeader = style({
gap: '8px', gap: '8px',
fontSize: cssVar('fontXs'), fontSize: cssVar('fontXs'),
fontWeight: 500, fontWeight: 500,
color: cssVar('textSecondaryColor'), color: cssVarV2('text/secondary'),
padding: '8px 16px', padding: '8px 16px',
minWidth: 200, minWidth: 200,
textTransform: 'uppercase', textTransform: 'uppercase',
@@ -468,7 +469,7 @@ export const propertyRowNamePopupRow = style({
gap: '8px', gap: '8px',
fontSize: cssVar('fontSm'), fontSize: cssVar('fontSm'),
fontWeight: 500, fontWeight: 500,
color: cssVar('textSecondaryColor'), color: cssVarV2('text/secondary'),
padding: '8px 16px', padding: '8px 16px',
minWidth: 260, minWidth: 260,
}); });
@@ -506,11 +507,11 @@ export const selectorButton = style({
padding: '4px 8px', padding: '4px 8px',
cursor: 'pointer', cursor: 'pointer',
':hover': { ':hover': {
backgroundColor: cssVar('hoverColor'), backgroundColor: cssVarV2('layer/background/hoverOverlay'),
}, },
selectors: { selectors: {
'&[data-required=true]': { '&[data-required=true]': {
color: cssVar('textDisableColor'), color: cssVarV2('text/disable'),
pointerEvents: 'none', pointerEvents: 'none',
}, },
}, },
@@ -528,9 +529,17 @@ export const propertyRowTypeItem = style({
}); });
export const propertyTypeName = style({ export const propertyTypeName = style({
color: cssVar('textSecondaryColor'), color: cssVarV2('text/secondary'),
fontSize: cssVar('fontSm'), fontSize: cssVar('fontSm'),
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: 4, gap: 4,
}); });
export const backLinksMenu = style({
background: cssVarV2('layer/white'),
maxWidth: 'calc(var(--affine-editor-width) / 2)',
width: '100%',
maxHeight: '30vh',
overflowY: 'auto',
});

View File

@@ -382,6 +382,7 @@ export const PageBacklinksPopup = ({
return ( return (
<Menu <Menu
contentOptions={{ contentOptions={{
className: styles.backLinksMenu,
onClick(e) { onClick(e) {
e.stopPropagation(); e.stopPropagation();
}, },