feat(getPageContentText): update getPageContentText to use post.content array

- modify content extraction logic to use post.content array
- avoid extra but wrong result by checking pageBlockMap.block
This commit is contained in:
anime
2025-07-09 14:39:47 +08:00
parent 3ad7605abe
commit 9321b2dfae

View File

@@ -84,12 +84,12 @@ export function getPageContentText(post, pageBlockMap) {
}
const postId = post.id
const postContent = post.content
let contentTextList = []
// 防止搜到加密文章的内容
if (pageBlockMap && pageBlockMap.block && !post.password) {
const contentIds = Object.keys(pageBlockMap.block)
for (const id of contentIds) {
const blockContentText = getBlockContentText(id)
if (postContent.length > 0 && !post.password) {
for (const postContentId of postContent) {
const blockContentText = getBlockContentText(postContentId)
if (blockContentText) {
contentTextList.push(blockContentText)
}