optimize: 更新内容展示优化。

pull/333/head
王良 4 months ago
parent 20b21843c4
commit 3e6eef757c

@ -203,7 +203,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
value: { value: {
version, version,
releaseNotes: versionData.body releaseNotes: versionData.body
? (versionData.body.replace(/\r\n/g, '\n').replace(/https:\/\/github.com\/docmirror\/dev-sidecar/g, '').replace(/(?<=(^|\n))[ \t]*[ #]+/g, '') || '无') ? (versionData.body.replace(/\r\n/g, '\n').replace(/https:\/\/github.com\/docmirror\/dev-sidecar/g, '').replace(/(?<=(^|\n))[ \t]*[ #]*#\s*/g, '') || '无')
: '无' : '无'
} }
}) })

@ -144,21 +144,18 @@ function install (app, api) {
title: '发现新版本v' + value.version, title: '发现新版本v' + value.version,
cancelText: '暂不升级', cancelText: '暂不升级',
okText: '升级', okText: '升级',
width: 550, width: 650,
content: h => { content: h => {
if (value.releaseNotes) { if (value.releaseNotes) {
const notes = [] const notes = []
if (typeof value.releaseNotes === 'string') { if (typeof value.releaseNotes === 'string') {
const releaseNotes = value.releaseNotes.replace(/\r?\n/g, '\n').split('\n') const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
for (const note of releaseNotes) {
notes.push(<div>{note}</div>)
}
return <div> return <div>
<div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div> <div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>更新内容</div> <div>更新内容</div>
<div style="max-height:350px;overflow-y:auto"> <pre style="max-height:350px;font-family:auto">
{notes} {releaseNotes}
</div> </pre>
</div> </div>
} else { } else {
for (const note of value.releaseNotes) { for (const note of value.releaseNotes) {
@ -194,16 +191,13 @@ function install (app, api) {
if (value.releaseNotes) { if (value.releaseNotes) {
const notes = [] const notes = []
if (typeof value.releaseNotes === 'string') { if (typeof value.releaseNotes === 'string') {
const releaseNotes = value.releaseNotes.replace(/\r?\n/g, '\n').split('\n') const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
for (const note of releaseNotes) {
notes.push(<div>{note}</div>)
}
return <div> return <div>
<div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div> <div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>更新内容</div> <div>更新内容</div>
<div style="max-height:350px;overflow-y:auto"> <pre style="max-height:350px;font-family:auto">
{notes} {releaseNotes}
</div> </pre>
</div> </div>
} else { } else {
for (const note of value.releaseNotes) { for (const note of value.releaseNotes) {

Loading…
Cancel
Save