Skip to content

Commit cbdf3dc

Browse files
feildmasterclaude
andcommitted
fix: format the update toast release notes
Send the release notes separately from the restart message and style the list in the page so it renders compactly with numbers instead of inheriting the toast's preserved whitespace. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 1382201 commit cbdf3dc

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎src/electron.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ function createWindow() {
164164
autoUpdater.on('update-downloaded', (info) => {
165165
toast({
166166
title: `UnderScript App Updated: v${info.version}`,
167-
text: `${info.releaseNotes}\n\nRestart App to finish update`
167+
notes: Array.isArray(info.releaseNotes) ? info.releaseNotes.map(({ note }) => note).join('') : info.releaseNotes,
168+
text: 'Restart App to finish update',
168169
});
169170
});
170171
if (app.isPackaged) autoUpdater.checkForUpdates().catch(console.error);

‎src/inject/app.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,25 @@
1414
});
1515
});
1616

17+
function formatNotes(html) {
18+
const { body } = new DOMParser().parseFromString(html, 'text/html');
19+
body.querySelectorAll('ol, ul').forEach((list) => {
20+
list.style.textAlign = 'left';
21+
list.style.whiteSpace = 'normal';
22+
list.style.listStyle = list.tagName === 'OL' ? 'decimal' : 'disc';
23+
list.style.margin = '0.5em 0';
24+
list.style.paddingLeft = '1.5em';
25+
});
26+
return body.innerHTML;
27+
}
28+
1729
underscriptApp.onToast((data) => {
1830
plugin.then((instance) => {
1931
if (!instance) return;
32+
if (data.notes) {
33+
data.text = `${formatNotes(data.notes)}${data.text ? `<p>${data.text}</p>` : ''}`;
34+
delete data.notes;
35+
}
2036
if (data.refresh) {
2137
data.onClose = () => location.reload();
2238
delete data.refresh;

0 commit comments

Comments
 (0)