mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
Merge pull request #1511 from tangly1024/fix/file-upload
Fix/file upload
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
|
||||
NEXT_PUBLIC_VERSION=4.0.14
|
||||
NEXT_PUBLIC_VERSION=4.0.15
|
||||
@@ -13,6 +13,6 @@ export default function WWAds({ orientation = 'vertical', sticky = false, classN
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`wwads-cn ${orientation === 'vertical' ? 'wwads-vertical' : 'wwads-horizontal'} ${sticky ? 'wwads-sticky' : ''} z-30 ${className || ''}`} data-id={BLOG.AD_WWADS_ID}></div>
|
||||
<div className={`wwads-cn ${orientation === 'vertical' ? 'wwads-vertical' : 'wwads-horizontal'} ${sticky ? 'wwads-sticky' : ''} z-10 ${className || ''}`} data-id={BLOG.AD_WWADS_ID}></div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ export async function getPageWithRetry(id, from, retryAttempts = 3) {
|
||||
|
||||
/**
|
||||
* 获取到的blockMap删除不需要的字段
|
||||
* 并且对于页面内容进行特殊处理,比如文件url格式化
|
||||
* @param {*} id 页面ID
|
||||
* @param {*} pageBlock 页面元素
|
||||
* @param {*} slice 截取数量
|
||||
@@ -72,6 +73,7 @@ function filterPostBlocks(id, pageBlock, slice) {
|
||||
const clonePageBlock = deepClone(pageBlock)
|
||||
let count = 0
|
||||
|
||||
// 循环遍历文档的每个block
|
||||
for (const i in clonePageBlock?.block) {
|
||||
const b = clonePageBlock?.block[i]
|
||||
if (slice && slice > 0 && count > slice) {
|
||||
@@ -99,6 +101,13 @@ function filterPostBlocks(id, pageBlock, slice) {
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是文件,或嵌入式PDF,需要重新加密签名
|
||||
if ((b?.value?.type === 'file' || b?.value?.type === 'pdf') && b?.value?.properties?.source?.[0][0]) {
|
||||
const oldUrl = b?.value?.properties?.source?.[0][0]
|
||||
const newUrl = `https://notion.so/signed/${encodeURIComponent(oldUrl)}?table=block&id=${b?.value?.id}`
|
||||
b.value.properties.source[0][0] = newUrl
|
||||
}
|
||||
|
||||
delete b?.role
|
||||
delete b?.value?.version
|
||||
delete b?.value?.created_by_table
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "notion-next",
|
||||
"version": "4.0.14",
|
||||
"version": "4.0.15",
|
||||
"homepage": "https://github.com/tangly1024/NotionNext.git",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user