mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
修复无法加载的PDF异常
This commit is contained in:
@@ -211,13 +211,16 @@ const Equation = dynamic(
|
||||
{ ssr: false }
|
||||
)
|
||||
|
||||
// 文档
|
||||
const Pdf = dynamic(
|
||||
() => import('react-notion-x/build/third-party/pdf').then(m => m.Pdf),
|
||||
{
|
||||
ssr: false
|
||||
}
|
||||
)
|
||||
// 原版文档
|
||||
// const Pdf = dynamic(
|
||||
// () => import('react-notion-x/build/third-party/pdf').then(m => m.Pdf),
|
||||
// {
|
||||
// ssr: false
|
||||
// }
|
||||
// )
|
||||
const Pdf = dynamic(() => import('@/components/Pdf').then(m => m.Pdf), {
|
||||
ssr: false
|
||||
})
|
||||
|
||||
// 美化代码 from: https://github.com/txs
|
||||
const PrismMac = dynamic(() => import('@/components/PrismMac'), {
|
||||
|
||||
14
components/Pdf.js
Normal file
14
components/Pdf.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 渲染pdf
|
||||
* 直接用googledocs预览pdf
|
||||
* @param {*} file
|
||||
* @returns
|
||||
*/
|
||||
export function Pdf({ file }) {
|
||||
const src =
|
||||
'https://docs.google.com/viewer?embedded=true&url=' +
|
||||
encodeURIComponent(file)
|
||||
return (
|
||||
<embed src={src} type='application/pdf' width='100%' height='100%'></embed>
|
||||
)
|
||||
}
|
||||
@@ -1976,9 +1976,9 @@ svg + .notion-page-title-text {
|
||||
/* color: var(--notion-gray); */
|
||||
}
|
||||
|
||||
.notion-asset-wrapper-pdf > div {
|
||||
/* .notion-asset-wrapper-pdf > div {
|
||||
width: unset !important;
|
||||
}
|
||||
} */
|
||||
|
||||
/* pdf预览适配页面 */
|
||||
.react-pdf__Page__canvas,
|
||||
|
||||
Reference in New Issue
Block a user