Skip to content

Commit

Permalink
[feat]:opt release note display
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie-zeng committed Nov 22, 2024
1 parent e82f7a0 commit 61e7ce9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/ipc/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ ipcMain.handle('ipc-examples', async (event, ...args) => {
const ecbPath = path.join(buildInExamplePath, ecb)
try {
const ecbContent = JSON.parse(await fsP.readFile(ecbPath, 'utf-8'))
if (ecbContent.example) {
{
//find same catalog
const catalog = ecbContent.example.catalog
const catalog = ecbContent.example?.catalog || 'normal'
let catalogNode = examples.find(e => e.data.level === 1 && e.data.catalog === catalog)
if (!catalogNode) {
catalogNode = {
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/src/views/home/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,10 @@ onMounted(() => {
//bind href click event
document.getElementById('mainReadme')?.addEventListener('click', (e) => {
//if e is <a> tag
console.log((e.target as HTMLElement).tagName)
if ((e.target as HTMLElement).tagName == 'A') {
e.preventDefault()
//get href
const href = (e.target as HTMLElement).getAttribute('href')
console.log(href)
window.electron.ipcRenderer.send('ipc-open-link', href)
}
})
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/src/views/home/readme.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@

#readme h2:before {
counter-increment: h2;
content: counter(h2)" ";
}

#readme h3:before {
counter-increment: h3;
content: counter(h2) "." counter(h3)" ";
}

#readme h4:before {
counter-increment: h4;
content: counter(h2) "." counter(h3) "." counter(h4)" ";
}

#readme .heading-highlight {
Expand Down
16 changes: 15 additions & 1 deletion src/renderer/src/views/home/update.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@
{{ version }} -> {{ updateInfo?.version }}
</el-tag>
</el-divider>
<div id="release_note">
<div v-if="doc != ''" style="text-align: left;margin:20px;color:#303133;"
>
<div v-html="doc" class="readme" id="readme"/>
<div v-html="doc" class="readme" />
</div>
<div v-else>
<el-skeleton :rows="5" />
</div>
</div>
</div>

</template>

Expand Down Expand Up @@ -93,6 +95,18 @@ const props = defineProps<{
const mainH = toRef(props, 'height')
onMounted(() => {
console.log(document.getElementById('release_note'),'xxx')
document.getElementById('release_note')?.addEventListener('click', (e) => {
//if e is <a> tag
console.log((e.target as HTMLElement).tagName)
if ((e.target as HTMLElement).tagName == 'A') {
e.preventDefault()
//get href
const href = (e.target as HTMLElement).getAttribute('href')
console.log(href)
window.electron.ipcRenderer.send('ipc-open-link', href)
}
})
marked.use(addLocalBaseUrl())
window.electron.ipcRenderer.on('ipc-update-available', (event, info: UpdateInfo) => {
/* open dialog when a new verison available */
Expand Down

0 comments on commit 61e7ce9

Please sign in to comment.