Skip to content

Commit

Permalink
feat: pdf embed view component
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Nov 1, 2024
1 parent c7ca99b commit 90f0665
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 183 deletions.
19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@
"which-typed-array": "npm:@nolyfill/which-typed-array@latest",
"@reforged/maker-appimage/@electron-forge/maker-base": "7.5.0",
"macos-alias": "npm:@napi-rs/[email protected]",
"fs-xattr": "npm:@napi-rs/xattr@latest"
"fs-xattr": "npm:@napi-rs/xattr@latest",
"@blocksuite/affine": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/all",
"@blocksuite/affine-block-embed": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/block-embed",
"@blocksuite/affine-block-list": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/block-list",
"@blocksuite/affine-block-paragraph": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/block-paragraph",
"@blocksuite/affine-block-surface": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/block-surface",
"@blocksuite/affine-components": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/components",
"@blocksuite/data-view": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/data-view",
"@blocksuite/affine-model": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/model",
"@blocksuite/affine-shared": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/shared",
"@blocksuite/affine-widget-scroll-anchoring": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/affine/widget-scroll-anchoring",
"@blocksuite/blocks": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/blocks",
"@blocksuite/block-std": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/framework/block-std",
"@blocksuite/global": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/framework/global",
"@blocksuite/inline": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/framework/inline",
"@blocksuite/store": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/framework/store",
"@blocksuite/sync": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/framework/sync",
"@blocksuite/presets": "portal:/Users/fundon/dev/toeverything/blocksuite/packages/presets"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import {
import {
AttachmentBlockService,
AttachmentBlockSpec,
AttachmentEmbedConfigIdentifier,
} from '@blocksuite/affine/blocks';
import bytes from 'bytes';
import { html } from 'lit';

class CustomAttachmentBlockService extends AttachmentBlockService {
override mounted(): void {
Expand All @@ -30,4 +32,16 @@ export const CustomAttachmentBlockSpec: ExtensionType[] = [
);
},
},
{
setup: di => {
di.override(AttachmentEmbedConfigIdentifier('pdf'), () => ({
name: 'pdf',
check: (model, maxFileSize) =>
model.type === 'application/pdf' && model.size <= maxFileSize,
template: (_, blobUrl) => {
return html`<div>${blobUrl}</div>`;
},
}));
},
},
];
6 changes: 3 additions & 3 deletions packages/frontend/i18n/src/i18n-completenesses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"ar": 82,
"ca": 6,
"da": 6,
"de": 31,
"de": 30,
"en": 100,
"es-AR": 15,
"es-CL": 17,
Expand All @@ -17,6 +17,6 @@
"ru": 80,
"sv-SE": 5,
"ur": 3,
"zh-Hans": 98,
"zh-Hant": 96
"zh-Hans": 97,
"zh-Hant": 95
}
Loading

0 comments on commit 90f0665

Please sign in to comment.