@salesforcedevs/docs-components
Advanced tools
Comparing version
@@ -21,3 +21,2 @@ { | ||
"doc/headingAnchor", | ||
"doc/markdownEditor", | ||
"doc/overview", | ||
@@ -24,0 +23,0 @@ "doc/phase", |
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.17.5-edit", | ||
"version": "1.17.5-search-alpha", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -48,3 +48,2 @@ import { LightningElement, api, track } from "lwc"; | ||
@api coveoSearchHub!: string; | ||
@api useOldSidebar: boolean = false; | ||
@api tocTitle?: string; | ||
@@ -51,0 +50,0 @@ @api tocOptions?: string; |
@@ -11,2 +11,15 @@ import { LightningElement, api } from "lwc"; | ||
/** | ||
* Returns a formatted title for the component playground | ||
* Maps 'aura' model to 'Aura' and 'lwc' model to 'Lightning' | ||
* Capitalizes the first letter of the component name | ||
* @returns {string} Formatted playground title | ||
*/ | ||
get playgroundTitle() { | ||
const modelName = this.model === "aura" ? "Aura" : "Lightning"; | ||
const componentName = | ||
this.component.charAt(0).toUpperCase() + this.component.slice(1); | ||
return `Example previews and code for ${modelName} ${componentName} component`; | ||
} | ||
get playgroundAvailable() { | ||
@@ -13,0 +26,0 @@ return ( |
@@ -213,6 +213,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
adjustNavPosition = () => { | ||
const sidebarType = this.useOldSidebar | ||
? "dx-sidebar-old" | ||
: "dx-sidebar"; | ||
const sidebarEl = this.template.querySelector(sidebarType); | ||
const sidebarEl = this.template.querySelector("dx-sidebar-old"); | ||
const globalNavEl = document.querySelector( | ||
@@ -219,0 +216,0 @@ "hgf-c360nav" |
@@ -14,3 +14,4 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
PageReference, | ||
TocMap | ||
TocMap, | ||
ContentData | ||
} from "./types"; | ||
@@ -76,3 +77,4 @@ import { SearchSyncer } from "docUtils/searchSyncer"; | ||
private language?: DocLanguage | null = null; | ||
private loaded = false; | ||
private displayContent = false; | ||
private display404 = false; | ||
private _pageHeader?: Header; | ||
@@ -190,3 +192,9 @@ private pdfUrl = ""; | ||
); | ||
this.fetchDocument().then(() => (this.loaded = true)); | ||
this.fetchDocument().then((content: any) => { | ||
if (content) { | ||
this.displayContent = true; | ||
} else { | ||
this.display404 = true; | ||
} | ||
}); | ||
window.addEventListener("popstate", this.handlePopState); | ||
@@ -469,3 +477,3 @@ | ||
async fetchDocument(): Promise<void> { | ||
async fetchDocument(): Promise<string> { | ||
this.setState({ | ||
@@ -484,3 +492,3 @@ isFetchingDocument: true | ||
}); | ||
return; | ||
return ""; | ||
} | ||
@@ -517,7 +525,7 @@ | ||
try { | ||
await this.fetchContent(); | ||
const moreData = await this.fetchContent(); | ||
this.setState({ | ||
isFetchingDocument: false | ||
}); | ||
return; | ||
return moreData.content; | ||
} catch (error) { | ||
@@ -536,5 +544,6 @@ this.pageReference.contentDocumentId = `${data.id}.htm`; | ||
}); | ||
return data.content; | ||
} | ||
async fetchContent(): Promise<void> { | ||
async fetchContent(): Promise<ContentData> { | ||
this.setState({ | ||
@@ -563,2 +572,3 @@ isFetchingContent: true | ||
}); | ||
return data; | ||
} | ||
@@ -565,0 +575,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
279608
-4.03%90
-3.23%6997
-4.18%