chore(core): temporarily hide export png and pdf in edgeless (#5364)

This commit is contained in:
JimmFly
2023-12-21 07:13:05 +00:00
parent 34c1d2a674
commit 332a5c6685
4 changed files with 21 additions and 8 deletions

View File

@@ -4,7 +4,9 @@ import { Divider } from '@affine/component/ui/divider';
import { WorkspaceFlavour } from '@affine/env/workspace';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { LinkIcon } from '@blocksuite/icons';
import { useAtomValue } from 'jotai';
import { currentModeAtom } from '../../../../atoms/mode';
import { useExportPage } from '../../../../hooks/affine/use-export-page';
import * as styles from './index.css';
import type { ShareMenuProps } from './share-menu';
@@ -23,6 +25,7 @@ export const ShareExport = ({
urlType: 'workspace',
});
const exportHandler = useExportPage(currentPage);
const currentMode = useAtomValue(currentModeAtom);
return (
<>
@@ -36,6 +39,7 @@ export const ShareExport = ({
<ExportMenuItems
exportHandler={exportHandler}
className={styles.menuItemStyle}
pageMode={currentMode}
/>
</div>
{workspace.flavour !== WorkspaceFlavour.LOCAL ? (

View File

@@ -182,7 +182,7 @@ export const PageHeaderMenuButton = ({ rename, pageId }: PageMenuProps) => {
>
{t['Import']()}
</MenuItem>
<Export exportHandler={exportHandler} />
<Export exportHandler={exportHandler} pageMode={currentMode} />
{workspace.flavour === WorkspaceFlavour.AFFINE_CLOUD &&
runtimeConfig.enablePageHistory ? (

View File

@@ -141,7 +141,7 @@ export function useRegisterBlocksuiteEditorCommands(
unsubs.push(
registerAffineCommand({
id: `editor:${mode}-export-to-pdf`,
preconditionStrategy,
preconditionStrategy: () => mode === 'page' && !trash,
category: `editor:${mode}`,
icon: mode === 'page' ? <PageIcon /> : <EdgelessIcon />,
label: t['Export to PDF'](),
@@ -167,7 +167,7 @@ export function useRegisterBlocksuiteEditorCommands(
unsubs.push(
registerAffineCommand({
id: `editor:${mode}-export-to-png`,
preconditionStrategy,
preconditionStrategy: () => mode === 'page' && !trash,
category: `editor:${mode}`,
icon: mode === 'page' ? <PageIcon /> : <EdgelessIcon />,
label: t['Export to PNG'](),