Skip to content

Commit

Permalink
optimize: 更新内容展示优化。
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Aug 16, 2024
1 parent 20b2184 commit 3e6eef7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/gui/src/bridge/update/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
value: {
version,
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, '') || '无')
: '无'
}
})
Expand Down
24 changes: 9 additions & 15 deletions packages/gui/src/bridge/update/front.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,18 @@ function install (app, api) {
title: '发现新版本:v' + value.version,
cancelText: '暂不升级',
okText: '升级',
width: 550,
width: 650,
content: h => {
if (value.releaseNotes) {
const notes = []
if (typeof value.releaseNotes === 'string') {
const releaseNotes = value.releaseNotes.replace(/\r?\n/g, '\n').split('\n')
for (const note of releaseNotes) {
notes.push(<div>{note}</div>)
}
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
return <div>
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>更新内容:</div>
<div style="max-height:350px;overflow-y:auto">
{notes}
</div>
<pre style="max-height:350px;font-family:auto">
{releaseNotes}
</pre>
</div>
} else {
for (const note of value.releaseNotes) {
Expand Down Expand Up @@ -194,16 +191,13 @@ function install (app, api) {
if (value.releaseNotes) {
const notes = []
if (typeof value.releaseNotes === 'string') {
const releaseNotes = value.releaseNotes.replace(/\r?\n/g, '\n').split('\n')
for (const note of releaseNotes) {
notes.push(<div>{note}</div>)
}
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
return <div>
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>更新内容:</div>
<div style="max-height:350px;overflow-y:auto">
{notes}
</div>
<pre style="max-height:350px;font-family:auto">
{releaseNotes}
</pre>
</div>
} else {
for (const note of value.releaseNotes) {
Expand Down

0 comments on commit 3e6eef7

Please sign in to comment.