减小页面体积

This commit is contained in:
tangly1024.com
2024-02-02 15:29:49 +08:00
parent c7485a443e
commit 248fcb00e1
2 changed files with 42 additions and 12 deletions

View File

@@ -87,12 +87,12 @@ export async function getPageWithRetry(id, from, retryAttempts = 3) {
* 2.比如文件、视频、音频、url格式化
* 3.代码块等元素兼容
* @param {*} id 页面ID
* @param {*} pageBlock 页面元素
* @param {*} blockMap 页面元素
* @param {*} slice 截取数量
* @returns
*/
function filterPostBlocks(id, pageBlock, slice) {
const clonePageBlock = deepClone(pageBlock)
function filterPostBlocks(id, blockMap, slice) {
const clonePageBlock = deepClone(blockMap)
let count = 0
// 循环遍历文档的每个block
@@ -132,14 +132,6 @@ function filterPostBlocks(id, pageBlock, slice) {
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
delete b?.value?.created_by_id
delete b?.value?.last_edited_by_table
delete b?.value?.last_edited_by_id
delete b?.value?.space_id
}
// 去掉不用的字段