@salesforcedevs/docs-components 1.3.85 → 1.3.86

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.85",
3
+ "version": "1.3.86",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "6b738627c2fefd4e639f1def42cdc4d4a44c7171"
27
+ "gitHead": "61133211828234c195a168b122293e153a40617b"
28
28
  }
@@ -287,8 +287,8 @@ export default class DocXmlContent extends LightningElementWithState<{
287
287
  };
288
288
  }
289
289
 
290
- private handlePopState = (): void =>
291
- this.updatePageReference(this.getReferenceFromUrl());
290
+ private handlePopState = (event: PopStateEvent): void =>
291
+ this.updatePageReference(this.getReferenceFromUrl(), event);
292
292
 
293
293
  handleSelect(event: CustomEvent<{ name: string }>): void {
294
294
  event.stopPropagation();
@@ -333,7 +333,10 @@ export default class DocXmlContent extends LightningElementWithState<{
333
333
  this.fetchDocument();
334
334
  };
335
335
 
336
- updatePageReference(newPageReference: PageReference): void {
336
+ updatePageReference(
337
+ newPageReference: PageReference,
338
+ event: PopStateEvent | undefined = undefined
339
+ ): void {
337
340
  this.pageReference.hash = newPageReference.hash;
338
341
  this.pageReference.search = newPageReference.search;
339
342
 
@@ -350,17 +353,16 @@ export default class DocXmlContent extends LightningElementWithState<{
350
353
  }
351
354
 
352
355
  this.fetchContent()
353
- .then(() => this.buildBreadcrumbs())
356
+ .then(() => {
357
+ this.buildBreadcrumbs();
358
+ document.body.scrollTop = event?.state?.scroll?.value || 0;
359
+ })
354
360
  .catch(handleContentError);
355
361
  }
356
362
 
357
363
  getReferenceFromUrl(): PageReference {
358
- const [
359
- page,
360
- docId,
361
- deliverable,
362
- contentDocumentId
363
- ] = window.location.pathname.substr(1).split("/");
364
+ const [page, docId, deliverable, contentDocumentId] =
365
+ window.location.pathname.substr(1).split("/");
364
366
 
365
367
  const { origin: domain, hash, search } = window.location;
366
368
 
@@ -527,14 +529,8 @@ export default class DocXmlContent extends LightningElementWithState<{
527
529
  }
528
530
 
529
531
  private pageReferenceToString(reference: PageReference): string {
530
- const {
531
- page,
532
- docId,
533
- deliverable,
534
- contentDocumentId,
535
- hash,
536
- search
537
- } = reference;
532
+ const { page, docId, deliverable, contentDocumentId, hash, search } =
533
+ reference;
538
534
  return `/${page}/${docId}/${deliverable}/${contentDocumentId}${this.normalizeSearch(
539
535
  search
540
536
  )}${this.normalizeHash(hash)}`;