Merge pull request #134 from hongwei1/develop

refactor/Enhance code styling in main.css and improve type safety in HeaderNav.vue. Added color for code blocks and updated type annotations for query selectors.
This commit is contained in:
Simon Redfern 2025-11-25 15:59:55 +01:00 committed by GitHub
commit 7d31179300
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -73,3 +73,10 @@ main {
font-size: 16px !important;
}
code[class*='language-'],
pre[class*='language-'],
.content code,
.content pre {
color: #000000;
}

View File

@ -58,7 +58,7 @@ const headerLinksHoverColor = ref(headerLinksHoverColorSetting)
const headerLinksBackgroundColor = ref(headerLinksBackgroundColorSetting)
const clearActiveTab = () => {
const activeLinks = document.querySelectorAll('.router-link')
const activeLinks = document.querySelectorAll<HTMLElement>('.router-link')
for (const active of activeLinks) {
// Skip login and logoff buttons
if (active.id && active.id !== 'login' && active.id !== 'logoff') {
@ -68,7 +68,7 @@ const clearActiveTab = () => {
}
}
const setActive = (target) => {
const setActive = (target: HTMLElement | null) => {
if (target) {
clearActiveTab()
target.style.backgroundColor = headerLinksBackgroundColor.value
@ -102,11 +102,11 @@ onMounted(async () => {
})
watchEffect(() => {
const path = route.name
if (path && route.params && !route.params.id) {
setActive(document.getElementById('header-nav-' + path))
const routeName = typeof route.name === 'string' ? route.name : null
if (routeName && route.params && !route.params.id) {
setActive(document.getElementById(`header-nav-${routeName}`))
} else {
if (path == 'message-docs') {
if (routeName === 'message-docs') {
clearActiveTab()
} else {
setActive(document.getElementById('header-nav-tags'))