feat: 优化同步文章时的文章 ID 链接形式
This commit is contained in:
parent
f9177c7703
commit
9a2685c0ed
@ -343,7 +343,9 @@ const uploadCloud = () => {
|
||||
const match = title.match(/^\[(.*?)\]\((.*?)\)$/);
|
||||
if (match) {
|
||||
title = match[1].trim(); // "标题"
|
||||
articleID = match[2].trim(); // "链接,例如 https://github.com"
|
||||
let url = match[2].trim(); // "链接,例如 https://example.com/blog/1"
|
||||
const matchID = url.match(/(\d+)$/);
|
||||
articleID = matchID ? matchID[1] : '';
|
||||
}
|
||||
|
||||
// 如果存在文章 ID,则更新该文章;否则发布该文章,并在文章 ID 中加入链接
|
||||
@ -372,7 +374,7 @@ const uploadCloud = () => {
|
||||
SubmitArticle(title, markdownLines.join('\n'))
|
||||
.then((data) => {
|
||||
articleID = data.id;
|
||||
markdownLines[0] = '# [' + title + '](' + articleID + ')';
|
||||
markdownLines[0] = '# [' + title + '](../' + articleID + ')';
|
||||
editorState.text = markdownLines.join('\n');
|
||||
Modal.remove();
|
||||
Message.success('同步成功');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user