Skip to content

Commit 287afab

Browse files
committed
release: v3.10.1
1 parent 5a51fce commit 287afab

File tree

2 files changed

+66
-15
lines changed

2 files changed

+66
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "surmon.me.admin",
3-
"version": "3.10.0",
3+
"version": "3.10.1",
44
"author": "Surmon",
55
"license": "MIT",
66
"homepage": "https://github.com/surmon-china/surmon.me.admin",

src/pages/Setting/Actions.tsx

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react'
2-
import { useShallowRef, useReactive, useComputed } from 'veact'
32
import { useLoading } from 'veact-use'
4-
import { Button, Row, Divider, Modal, Checkbox, Flex, Typography } from 'antd'
3+
import { useShallowRef, useReactive, useComputed } from 'veact'
4+
import { Button, Row, Flex, Divider, Modal, Checkbox, Typography, Tabs } from 'antd'
55
import * as Icons from '@ant-design/icons'
66
import * as api from '@/apis/system'
77
import { getAllArticles } from '@/apis/article'
8+
import { getBlogArticleUrl } from '@/transforms/url'
89
import { Article, ArticlePublic, ArticlePublish } from '@/constants/article'
910
import { UniversalEditor, UnEditorLanguage } from '@/components/common/UniversalEditor'
1011

@@ -49,6 +50,28 @@ export const ActionsForm: React.FC = () => {
4950
return JSON.stringify(filteredArticles.value, null, 2)
5051
})
5152

53+
const filteredArticlesMarkdown = useComputed(() => {
54+
return filteredArticles.value
55+
.map((article) => {
56+
return [
57+
`# ${article.title}`,
58+
``,
59+
`## 文章信息`,
60+
`- 分类:${article.categories.map((c) => c.name || c.slug).join(', ')}`,
61+
`- 标签:${article.tags.map((t) => t.name || t.slug).join(', ')}`,
62+
`- 引言:${article.description?.replace(/\n/g, ' ').trim() || '暂无引言'}`,
63+
`- 发布时间:${new Date(article.created_at!).toLocaleString('zh-CN', { hour12: false })}`,
64+
`- 原文链接:${getBlogArticleUrl(article.id!)}`,
65+
``,
66+
`## 正文内容`,
67+
`${article.content}`
68+
]
69+
.join('\n')
70+
.trim()
71+
})
72+
.join('\n\n-----\n\n')
73+
})
74+
5275
const handleArticlesPublicOnlyChange = (value: boolean) => {
5376
articlesState.publicOnly = value
5477
}
@@ -94,8 +117,8 @@ export const ActionsForm: React.FC = () => {
94117
导出全量文章数据
95118
</Button>
96119
<Modal
97-
title="全量文章数据"
98-
width="70%"
120+
title="导出全量文章数据"
121+
width="80%"
99122
footer={null}
100123
maskClosable={false}
101124
loading={articlesLoading.state.value}
@@ -115,16 +138,44 @@ export const ActionsForm: React.FC = () => {
115138
</Typography.Text>
116139
</Flex>
117140
<Divider />
118-
<UniversalEditor
119-
rows={24}
120-
value={filteredArticlesJsonString.value}
121-
eid="app-export-all-articles"
122-
placeholder="全站全量文章数据"
123-
disbaled={true}
124-
defaultLanguage={UnEditorLanguage.JSON}
125-
disabledLanguageSelect={true}
126-
disabledCacheDraft={true}
127-
disabledLineNumbers={true}
141+
<Tabs
142+
size="middle"
143+
items={[
144+
{
145+
key: 'json',
146+
icon: <Icons.FileOutlined />,
147+
label: 'JSON 格式原始数据',
148+
children: (
149+
<UniversalEditor
150+
rows={24}
151+
value={filteredArticlesJsonString.value}
152+
eid="app-all-articles-json"
153+
defaultLanguage={UnEditorLanguage.JSON}
154+
disabledLanguageSelect={false}
155+
disabledCacheDraft={true}
156+
disabledLineNumbers={true}
157+
disbaled={true}
158+
/>
159+
)
160+
},
161+
{
162+
key: 'llm-friendly-markdown',
163+
icon: <Icons.OpenAIOutlined />,
164+
label: 'LLM 友好的 Markdown 格式数据',
165+
children: (
166+
<UniversalEditor
167+
rows={24}
168+
value={filteredArticlesMarkdown.value}
169+
eid="app-all-articles-markdown"
170+
defaultLanguage={UnEditorLanguage.Markdown}
171+
disabledLanguageSelect={false}
172+
disabledCacheDraft={true}
173+
disabledLineNumbers={true}
174+
disbaled={true}
175+
/>
176+
)
177+
}
178+
]}
128179
/>
129180
</Modal>
130181
</Row>

0 commit comments

Comments
 (0)