diff --git a/packages/frontend/apps/electron/src/main/windows-manager/tab-views-meta-schema.ts b/packages/frontend/apps/electron/src/main/windows-manager/tab-views-meta-schema.ts
index 18a77dba12438..4fca530a475cf 100644
--- a/packages/frontend/apps/electron/src/main/windows-manager/tab-views-meta-schema.ts
+++ b/packages/frontend/apps/electron/src/main/windows-manager/tab-views-meta-schema.ts
@@ -9,6 +9,8 @@ export const workbenchViewIconNameSchema = z.enum([
'page',
'edgeless',
'journal',
+ 'attachment',
+ 'pdf',
]);
export const workbenchViewMetaSchema = z.object({
diff --git a/packages/frontend/component/src/components/attachment-viewer/titlebar.tsx b/packages/frontend/component/src/components/attachment-viewer/titlebar.tsx
index 9b3817767b0b1..0874a8e10ac8f 100644
--- a/packages/frontend/component/src/components/attachment-viewer/titlebar.tsx
+++ b/packages/frontend/component/src/components/attachment-viewer/titlebar.tsx
@@ -1,4 +1,4 @@
-import type { AttachmentBlockModel } from '@blocksuite/blocks';
+import type { AttachmentBlockModel } from '@blocksuite/affine/blocks';
import {
EditIcon,
LocalDataIcon,
@@ -12,23 +12,28 @@ import { useState } from 'react';
import { IconButton } from '../../ui/button';
import { Menu, MenuItem } from '../../ui/menu';
import * as styles from './styles.css';
+import { saveBufferToFile } from './utils';
const items = [
{
name: 'Rename',
icon: ,
- action() {},
+ action(_model: AttachmentBlockModel) {},
},
{
name: 'Download',
icon: ,
- action() {},
+ action(model: AttachmentBlockModel) {
+ const { sourceId, name } = model;
+ if (!sourceId) return;
+ saveBufferToFile(sourceId, name).catch(console.error);
+ },
},
];
-export const MenuItems = () =>
+export const MenuItems = ({ model }: { model: AttachmentBlockModel }) =>
items.map(({ name, icon, action }) => (
-