-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): circular dependency in pdf embed view (#9331)
- Loading branch information
Showing
7 changed files
with
31 additions
and
40 deletions.
There are no files selected for viewing
8 changes: 2 additions & 6 deletions
8
packages/frontend/core/src/components/attachment-viewer/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 11 additions & 12 deletions
23
packages/frontend/core/src/components/attachment-viewer/pdf-viewer-embedded.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import type { AttachmentBlockModel } from '@blocksuite/affine/blocks'; | ||
|
||
import { AttachmentPreviewErrorBoundary } from './error'; | ||
import { PDFViewerEmbeddedInner } from './pdf-viewer-embedded-inner'; | ||
import type { AttachmentViewerProps } from './types'; | ||
import { buildAttachmentProps } from './utils'; | ||
|
||
export interface PDFViewerEmbeddedProps { | ||
model: AttachmentBlockModel; | ||
name: string; | ||
ext: string; | ||
size: string; | ||
} | ||
|
||
export function PDFViewerEmbedded(props: PDFViewerEmbeddedProps) { | ||
return <PDFViewerEmbeddedInner {...props} />; | ||
} | ||
// In Embed view | ||
export const AttachmentEmbedPreview = ({ model }: AttachmentViewerProps) => { | ||
return ( | ||
<AttachmentPreviewErrorBoundary key={model.id}> | ||
<PDFViewerEmbeddedInner {...buildAttachmentProps(model)} /> | ||
</AttachmentPreviewErrorBoundary> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/frontend/core/src/components/attachment-viewer/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { AttachmentBlockModel } from '@blocksuite/affine/blocks'; | ||
|
||
export type AttachmentViewerProps = { | ||
model: AttachmentBlockModel; | ||
}; | ||
|
||
export type PDFViewerProps = { | ||
model: AttachmentBlockModel; | ||
name: string; | ||
ext: string; | ||
size: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters