fix: page crash in public workspace (#1324)

This commit is contained in:
Himself65
2023-03-05 02:29:02 -06:00
committed by GitHub
parent bd4977e94e
commit 5b75d32a8a
9 changed files with 65 additions and 20 deletions

View File

@@ -30,7 +30,6 @@ export const BlockSuitePublicPageList: React.FC<BlockSuitePageListProps> = ({
isPublic={true}
blockSuiteWorkspace={blockSuiteWorkspace}
onClickPage={onOpenPage}
listType="all"
/>
);
};

View File

@@ -149,7 +149,7 @@ export const PageList: React.FC<PageListProps> = ({
{pageMeta.title || t('Untitled')}
</Content>
</StyledTitleLink>
{!isTrash && (
{listType && !isTrash && (
<FavoriteTag
onClick={() => {
helper.setPageMeta(pageMeta.id, {

View File

@@ -20,12 +20,14 @@ import {
export type BlockSuiteEditorHeaderProps = React.PropsWithChildren<{
blockSuiteWorkspace: BlockSuiteWorkspace;
pageId: string;
isPublic?: boolean;
}>;
export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
blockSuiteWorkspace,
pageId,
children,
isPublic,
}) => {
const page = blockSuiteWorkspace.getPage(pageId);
// fixme(himself65): remove this atom and move it to props
@@ -43,7 +45,10 @@ export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
return (
<Header
rightItems={
isTrash
// fixme(himself65): other right items not supported in public mode
isPublic
? ['themeModeSwitch']
: isTrash
? ['trashButtonGroup']
: ['syncUser', 'themeModeSwitch', 'editorOptionMenu']
}