Skip to content

Commit 896409a

Browse files
committed
Refactor
1 parent 37b84da commit 896409a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vellum-doc.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class VellumDocument extends LitElement {
8686
override connectedCallback() {
8787
super.connectedCallback()
8888
this.labelHeaders()
89+
this.exportIndexParts()
8990
}
9091

9192
labelHeaders() {
@@ -96,7 +97,6 @@ export class VellumDocument extends LitElement {
9697
: Math.random().toString(36).slice(2)
9798

9899
heading.id = newId
99-
heading.part.add(`index-${heading.localName}`)
100100
}
101101
})
102102
}
@@ -116,6 +116,12 @@ export class VellumDocument extends LitElement {
116116
})
117117
}
118118

119+
exportIndexParts() {
120+
this.headings.forEach(heading => {
121+
heading.part.add(`index-${heading.localName}`)
122+
})
123+
}
124+
119125
override render() {
120126
return html`
121127
<div id="sidebar">

0 commit comments

Comments
 (0)