@salesforcedevs/docs-components
Advanced tools
Comparing version
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.345-refactor-tab-alpha4", | ||
"version": "1.3.345-refactor-tab-alpha5", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -389,2 +389,18 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
setHashAndHeaderForDocHeading(headingElements: any) { | ||
for (const headingElement of headingElements as any) { | ||
// Sometimes elements hash and header is not being set when slot content is wrapped with div | ||
if (!headingElement.hash) { | ||
headingElement.hash = headingElement.attributes.hash?.nodeValue; | ||
} | ||
if (!headingElement.header) { | ||
headingElement.header = | ||
headingElement.attributes.header?.nodeValue; | ||
} | ||
} | ||
this.updateTocItems(headingElements); | ||
} | ||
onSlotChange(event: Event): void { | ||
@@ -403,10 +419,3 @@ const slotElements = ( | ||
for (const headingElement of headingElements as any) { | ||
// Sometimes elements hash and header is not being set when slot content is wrapped with div | ||
headingElement.hash = headingElement.attributes.hash?.nodeValue; | ||
headingElement.header = | ||
headingElement.attributes.header?.nodeValue; | ||
} | ||
this.updateTocItems(headingElements); | ||
this.setHashAndHeaderForDocHeading(headingElements); | ||
} | ||
@@ -413,0 +422,0 @@ } |
@@ -38,18 +38,7 @@ import ContentLayout from "doc/contentLayout"; | ||
const headingElements = this.getHeadingElements(); | ||
headingElements.forEach((headingElement: any) => { | ||
// Sometimes elements hash and header is not being set when slot content is wrapped with div | ||
if (!headingElement.hash) { | ||
headingElement.hash = headingElement.attributes.hash?.nodeValue; | ||
} | ||
if (!headingElement.header) { | ||
headingElement.header = | ||
headingElement.attributes.header?.nodeValue; | ||
} | ||
}); | ||
this.updateTocItems(headingElements); | ||
this.setHashAndHeaderForDocHeading(headingElements); | ||
}; | ||
protected getHeadingElements() { | ||
let headingElements = document.querySelectorAll(TOC_HEADER_TAG); | ||
let headingElements = super.getHeadingElements(); | ||
if (this.showTabBasedRNB) { | ||
@@ -177,5 +166,2 @@ const tabPanelListItem: any = this.getTabPanelList(); | ||
updateHeadingForRNB(): void { | ||
// Note: We are doing document.querySelectorAll as a quick fix as we are not getting heading elements reference this.querySelectorAll | ||
const headingElements = this.getHeadingElements(); | ||
// We only need to update URL in case of /docs and ignore if tabs are used anywhere else in DSC | ||
@@ -185,3 +171,3 @@ if (this.showTabBasedRNB) { | ||
} | ||
this.addObserverAndScroll(headingElements); | ||
super.updateHeadingForRNB(); | ||
} | ||
@@ -188,0 +174,0 @@ |
275824
-0.17%6878
-0.07%