vitepress-theme-element-plus 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/utils/client/outline.ts +17 -10
- package/package.json +1 -1
|
@@ -40,18 +40,25 @@ export function getHeaders(range: DefaultTheme.Config['outline']): MenuItem[] {
|
|
|
40
40
|
return resolveHeaders(headers, range)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function serializeHeader(h: Element): { text: string, tags: string[] } {
|
|
44
|
-
let text = ''
|
|
45
|
-
const tags: string[] = []
|
|
46
|
-
for (const node of Array.from(h.childNodes)) {
|
|
47
|
-
if (node.nodeType === 1) {
|
|
48
|
-
const element = node as HTMLElement
|
|
43
|
+
function serializeHeader(h: Element): { text: string, tags: string[] } {
|
|
44
|
+
let text = ''
|
|
45
|
+
const tags: string[] = []
|
|
46
|
+
for (const node of Array.from(h.childNodes)) {
|
|
47
|
+
if (node.nodeType === 1) {
|
|
48
|
+
const element = node as HTMLElement
|
|
49
49
|
if (ignoreRE.test(element.className))
|
|
50
50
|
continue
|
|
51
|
-
if (element.classList.contains('el-tag') || element.classList.contains('vp-tag')) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (element.classList.contains('el-tag') || element.classList.contains('vp-tag')) {
|
|
52
|
+
const cloned = element.cloneNode(true) as HTMLElement
|
|
53
|
+
const transitionClassRE = /(?:^|-)enter-(?:active|from|to)$|(?:^|-)leave-(?:active|from|to)$/
|
|
54
|
+
for (const cls of Array.from(cloned.classList)) {
|
|
55
|
+
if (transitionClassRE.test(cls) || cls.startsWith('el-zoom-in-center-')) {
|
|
56
|
+
cloned.classList.remove(cls)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
tags.push(cloned.outerHTML)
|
|
60
|
+
continue
|
|
61
|
+
}
|
|
55
62
|
text += element.textContent ?? ''
|
|
56
63
|
}
|
|
57
64
|
else if (node.nodeType === 3) {
|