Skip to content

Commit ee4c859

Browse files
committed
Quartz sync: May 22, 2025, 5:49 PM
1 parent a4567f1 commit ee4c859

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

quartz/components/Explorer.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,6 @@ export default ((userOpts?: Partial<Options>) => {
116116
<polyline points="6 9 12 15 18 9"></polyline>
117117
</svg>
118118
</button>
119-
{/* <div
120-
class="title-button desktop-explorer"
121-
data-mobile={false}
122-
aria-expanded={true}
123-
>
124-
<h2>{opts.title ?? i18n(cfg.locale).components.explorer.title}</h2>
125-
</div> */}
126-
127119
<div class="explorer-content" aria-expanded={false}>
128120
<OverflowList class="explorer-ul" />
129121
</div>

quartz/components/MarkmapViewer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ function replacement(currentPath: FullSlug) {
3838
if (isImage) {
3939
return `<img src="../../../${currentPath}/../attachments/${link}" alt="${displayText || link}" />`
4040
}
41-
4241
const safeLink = `quartz-${link.trim().replace(/\s+/g, "-")}`
43-
return `<a href="/${safeLink}">${displayText || link}</a>`
42+
return `<a href="/${safeLink}" class="inner">${displayText || link}</a>`
4443
}
4544
}
4645

quartz/components/scripts/markmap.inline.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { Transformer } from "markmap-lib"
33
import { Toolbar } from "markmap-toolbar"
44
import { registerEscapeHandler } from "./util"
55

6+
const externalIcon = `
7+
<svg aria-hidden="true" class="external-icon" style="max-width:0.8em;max-height:0.8em; margin-left:0.2em;" viewBox="0 0 512 512">
8+
<path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"/>
9+
</svg>`.trim()
10+
611
function renderGlobalMarkmap() {
712
const transformer = new Transformer()
813
const { styles } = transformer.getAssets();
@@ -18,6 +23,7 @@ function renderGlobalMarkmap() {
1823
markmapOptions.scrollForPan = false
1924

2025
const container = document.querySelector(".global-markmap-outer") as HTMLElement
26+
const containerInner = container.querySelector('.global-markmap-container') as HTMLElement
2127
const svg = container.querySelector("#global-markmap") as SVGSVGElement
2228
const toolbarEl = container.querySelector("#global-markmap-toolbar") as HTMLElement
2329

@@ -37,11 +43,36 @@ function renderGlobalMarkmap() {
3743
const data = JSON.parse(decodeURIComponent(raw))
3844
const mm = Markmap.create(svg, markmapOptions, data)
3945
const toolbar = Toolbar.create(mm)
40-
toolbarEl.append(toolbar.render())
41-
46+
const mmToolbar = toolbar.render()
47+
toolbarEl.append(mmToolbar)
4248
mm.fit()
49+
50+
const customToolbar = document.createElement("div");
51+
customToolbar.className = "mm-toolbar-item";
52+
customToolbar.title = "Toggle fullscreen";
53+
54+
customToolbar.innerHTML = `
55+
<svg xmlns="http://www.w3.org/2000/svg" height="15" viewBox="0 -960 960 960" width="15" aria-hidden="true">
56+
<path stroke="none" fill="currentColor" fill-rule="evenodd"
57+
d="M120-120v-320h80v184l504-504H520v-80h320v320h-80v-184L256-200h184v80H120Z"/>
58+
</svg>
59+
`;
60+
mmToolbar.append(customToolbar);
61+
62+
svg.querySelectorAll<HTMLAnchorElement>('a[href^="http"]').forEach(a => {
63+
a.classList.add('external')
64+
})
65+
66+
svg.querySelectorAll<HTMLAnchorElement>('a.external').forEach(a => {
67+
a.insertAdjacentHTML('beforeend', externalIcon)
68+
})
69+
4370
container.classList.add("active")
4471

72+
customToolbar.addEventListener('click', () => {
73+
containerInner.classList.toggle('fullscreen')
74+
})
75+
4576
registerEscapeHandler(container, hideGlobalMarkmap)
4677
}
4778

quartz/components/styles/markmap.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
transform: translate(-50%, -50%);
2828
height: 80vh;
2929
width: 80vw;
30+
transition: width 0.2s ease, height 0.2s ease, top 0.2s ease, left 0.2s ease, transform 0.2s ease;
31+
32+
&.fullscreen {
33+
top: 0;
34+
left: 0;
35+
transform: none;
36+
width: 100vw;
37+
height: 100vh;
38+
}
3039

3140
@media all and not ($desktop) {
3241
width: 90%;

0 commit comments

Comments
 (0)