fix(core): adjust share edgeless display error (#5263)

close #5261

https://github.com/toeverything/AFFiNE/assets/102217452/8a7c4347-96df-45a3-973a-806876e5703d
This commit is contained in:
JimmFly
2023-12-11 10:55:23 +00:00
parent 30ecee483d
commit 38e46bc3b2
4 changed files with 20 additions and 2 deletions

View File

@@ -10,6 +10,9 @@ export const editor = style({
'--affine-editor-side-padding': '15px', '--affine-editor-side-padding': '15px',
}, },
}, },
'&.is-public-page': {
height: '100%',
},
}, },
}); });

View File

@@ -16,12 +16,19 @@ interface HeaderPros {
right?: ReactNode; right?: ReactNode;
center?: ReactNode; center?: ReactNode;
bottomBorder?: boolean; bottomBorder?: boolean;
isFloat?: boolean;
} }
// The Header component is used to solve the following problems // The Header component is used to solve the following problems
// 1. Manage layout issues independently of page or business logic // 1. Manage layout issues independently of page or business logic
// 2. Dynamic centered middle element (relative to the main-container), when the middle element is detected to collide with the two elements, the line wrapping process is performed // 2. Dynamic centered middle element (relative to the main-container), when the middle element is detected to collide with the two elements, the line wrapping process is performed
export const Header = ({ left, center, right, bottomBorder }: HeaderPros) => { export const Header = ({
left,
center,
right,
bottomBorder,
isFloat,
}: HeaderPros) => {
const sidebarSwitchRef = useRef<HTMLDivElement | null>(null); const sidebarSwitchRef = useRef<HTMLDivElement | null>(null);
const leftSlotRef = useRef<HTMLDivElement | null>(null); const leftSlotRef = useRef<HTMLDivElement | null>(null);
const centerSlotRef = useRef<HTMLDivElement | null>(null); const centerSlotRef = useRef<HTMLDivElement | null>(null);
@@ -45,7 +52,9 @@ export const Header = ({ left, center, right, bottomBorder }: HeaderPros) => {
const appSidebarFloating = useAtomValue(appSidebarFloatingAtom); const appSidebarFloating = useAtomValue(appSidebarFloatingAtom);
return ( return (
<div <div
className={clsx(style.header, bottomBorder && style.bottomBorder)} className={clsx(style.header, bottomBorder && style.bottomBorder, {
[style.headerFloat]: isFloat,
})}
data-open={open} data-open={open}
data-sidebar-floating={appSidebarFloating} data-sidebar-floating={appSidebarFloating}
data-testid="header" data-testid="header"

View File

@@ -24,6 +24,11 @@ export const header = style({
}, },
} as ComplexStyleRule); } as ComplexStyleRule);
export const headerFloat = style({
position: 'absolute',
width: '100%',
});
export const bottomBorder = style({ export const bottomBorder = style({
borderBottom: '1px solid var(--affine-border-color)', borderBottom: '1px solid var(--affine-border-color)',
}); });

View File

@@ -20,6 +20,7 @@ export function ShareHeader({
return ( return (
<Header <Header
isFloat={publishMode === 'edgeless'}
left={<ShareHeaderLeftItem />} left={<ShareHeaderLeftItem />}
center={ center={
<BlockSuiteHeaderTitle <BlockSuiteHeaderTitle