Skip to content

Commit

Permalink
Merge pull request #664 from terwer/dev
Browse files Browse the repository at this point in the history
fix: 修复 WordPress 摘要更新未生效的问题
  • Loading branch information
terwer committed Aug 26, 2023
2 parents 74f9875 + 65feeb2 commit bdf22d6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/adaptors/api/base/metaweblog/metaweblogBlogApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ class MetaweblogBlogApiAdaptor extends BaseBlogApi {
})
}

if (!StrUtil.isEmptyString(post.mt_excerpt)) {
Object.assign(postObj, {
mt_excerpt: post.mt_excerpt,
})
}

if (!StrUtil.isEmptyString(post.mt_text_more)) {
Object.assign(postObj, {
mt_text_more: post.mt_text_more,
})
}

if (!StrUtil.isEmptyString(post.description)) {
Object.assign(postObj, {
description: post.description,
Expand Down Expand Up @@ -294,16 +306,6 @@ class MetaweblogBlogApiAdaptor extends BaseBlogApi {
}

return postObj
// return {
// title: post.title || '',
// mt_keywords: post.mt_keywords || '',
// description: post.description || '',
// wp_slug: post.wp_slug || '',
// dateCreated: post.dateCreated.toISOString() || new Date().toISOString(),
// categories: post.categories || [],
// post_status: post.post_status || POST_STATUS_CONSTANTS.POST_STATUS_PUBLISH,
// wp_password: post.wp_password || ''
// }
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/publish/BatchPublishIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ const syncDynList = (selectedKeys: string[]) => {
const syncDesc = (val: string) => {
formData.siyuanPost.shortDesc = val
formData.siyuanPost.mt_text_more = val
formData.siyuanPost.mt_excerpt = val
logger.debug("syncDesc in batch publish")
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/publish/SinglePublishDoPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ const syncPublishTitle = (val: string) => {
const syncDesc = (val: string) => {
formData.mergedPost.shortDesc = val
formData.mergedPost.mt_text_more = val
formData.mergedPost.mt_excerpt = val
logger.debug("syncDesc in single publish")
}
Expand Down
3 changes: 3 additions & 0 deletions src/composables/usePublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ const usePublish = () => {
post = await api.preEditPost(post, id, publishCfg)
logger.debug(`after preEditPost, post=>`, toRaw(post))

// 同步摘要
post.mt_excerpt = post.shortDesc
post.mt_text_more = post.shortDesc
// 发布格式
if (cfg?.pageType == PageTypeEnum.Markdown) {
post.description = post.markdown
Expand Down

0 comments on commit bdf22d6

Please sign in to comment.