Commit 02b3cd2a13
Unsigned
Layout: unified · split
docs/.vitepress/theme/Layout.vue +17 −1
| @@ -361,9 +361,25 @@ const reloadTakodachi = () => { | |||
| 361 | } | 361 | } |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | function initTitleOnly() { | ||
| 365 | document.querySelectorAll('.custom-block').forEach(block => { | ||
| 366 | const children = [...block.children] | ||
| 367 | const hasOnlyTitle = children.every(el => el.classList.contains('custom-block-title')) | ||
| 368 | if (hasOnlyTitle) block.classList.add('title-only') | ||
| 369 | }) | ||
| 370 | } | ||
| 371 | |||
| 372 | watch( | ||
| 373 | () => route.path, | ||
| 374 | () => nextTick(() => initTitleOnly()), | ||
| 375 | { flush: 'post' } | ||
| 376 | ) | ||
| 377 | |||
| 364 | onMounted(() => { | 378 | onMounted(() => { |
| 365 | if (import.meta.env.SSR) return | 379 | if (import.meta.env.SSR) return |
| 366 | 380 | ||
| 381 | initTitleOnly() | ||
| 382 | |||
| 367 | // Icon tooltip: fixed-position popup appended to <body> to escape table overflow clipping | 383 | // Icon tooltip: fixed-position popup appended to <body> to escape table overflow clipping |
| 368 | const tooltipEl = document.createElement('div') | 384 | const tooltipEl = document.createElement('div') |
| 369 | tooltipEl.className = 'icon-tip-popup' | 385 | tooltipEl.className = 'icon-tip-popup' |
| @@ -610,4 +626,4 @@ onUnmounted(() => { | |||
| 610 | </span> | 626 | </span> |
| 611 | </template> | 627 | </template> |
| 612 | </Layout> | 628 | </Layout> |
| 613 | </template> | 629 | </template>\ No newline at end of file |
docs/.vitepress/theme/styles/style.scss +4 −2
| @@ -1672,6 +1672,8 @@ html.reduce-blur-effects { | |||
| 1672 | margin-top: 3px; | 1672 | margin-top: 3px; |
| 1673 | } | 1673 | } |
| 1674 | 1674 | ||
| 1675 | .vp-doc .custom-block { | 1675 | /* so that the gap only applies to title only blocks. check layout.vue for initTitleOnly() */ |
| 1676 | |||
| 1677 | .vp-doc .custom-block.title-only { | ||
| 1676 | padding-bottom: 16px; | 1678 | padding-bottom: 16px; |
| 1677 | } | 1679 | }\ No newline at end of file |