u
This commit is contained in:
parent
5f3cc1fb12
commit
27cc887045
@ -343,12 +343,16 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 20250621 todo 如果 text 是 {enUS,zhCN} 怎么处理
|
// 20250621 todo 如果 text 是 {enUS,zhCN} 怎么处理
|
||||||
extract_story_title (story) {
|
extract_story_title ({ story, lang = 'enUS' } = {}) {
|
||||||
if (Array.isArray(story) && story.length) {
|
if (Array.isArray(story) && story.length) {
|
||||||
return (
|
return (
|
||||||
story
|
story
|
||||||
.map(({ text = '' } = {}) => text.trim?.()?.replace?.(/\n/g, ' '))
|
.map(({ text = '' } = {}) => {
|
||||||
|
if (typeof text === 'string') return text.trim?.()?.replace?.(/\n/g, ' ')
|
||||||
|
else if (typeof text === 'object') return text[lang]?.trim?.()?.replace?.(/\n/g, ' ')
|
||||||
|
})
|
||||||
?.join(' ')
|
?.join(' ')
|
||||||
|
?.trim?.()
|
||||||
?.substring?.(0, 140) || ''
|
?.substring?.(0, 140) || ''
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user