@salesforcedevs/docs-components 0.56.2-comp-flex-ref-1 → 0.56.2-comp-flex-ref-2
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
|
@@ -105,7 +105,7 @@ export default class AmfReference extends LightningElement {
|
|
|
105
105
|
// This is to check if the url is hash based and redirect if needed
|
|
106
106
|
const redirectUrl = this.getHashBasedRedirectUrl();
|
|
107
107
|
if (redirectUrl) {
|
|
108
|
-
location.href = redirectUrl;
|
|
108
|
+
window.location.href = redirectUrl;
|
|
109
109
|
} else {
|
|
110
110
|
this.updateAmfConfigInView();
|
|
111
111
|
}
|
|
@@ -591,16 +591,16 @@ export default class AmfReference extends LightningElement {
|
|
|
591
591
|
referenceId: string,
|
|
592
592
|
type: string,
|
|
593
593
|
topic: { id: string; domId: string }
|
|
594
|
-
): string {
|
|
594
|
+
): string | undefined {
|
|
595
595
|
const { urlIdentifer, prefix } = URL_CONFIG[type];
|
|
596
596
|
|
|
597
597
|
// encodeURI to avoid special characters in the URL meta.
|
|
598
598
|
const identifier =
|
|
599
599
|
topic[urlIdentifer] && this.encodeIdentifier(topic[urlIdentifer]);
|
|
600
|
-
|
|
600
|
+
let meta;
|
|
601
601
|
// Assuming that there will be an identifier always
|
|
602
602
|
if (identifier) {
|
|
603
|
-
|
|
603
|
+
meta = prefix ? `${prefix}${identifier}` : `${identifier}`;
|
|
604
604
|
this.metadata[meta] = {
|
|
605
605
|
parentReferencePath,
|
|
606
606
|
meta,
|
|
@@ -610,8 +610,8 @@ export default class AmfReference extends LightningElement {
|
|
|
610
610
|
identifier,
|
|
611
611
|
type
|
|
612
612
|
};
|
|
613
|
-
return meta;
|
|
614
613
|
}
|
|
614
|
+
return meta;
|
|
615
615
|
}
|
|
616
616
|
|
|
617
617
|
/**
|
|
@@ -768,7 +768,7 @@ export default class AmfReference extends LightningElement {
|
|
|
768
768
|
* The API Navigation event will always intend to navigate within the current reference
|
|
769
769
|
* @param event
|
|
770
770
|
*/
|
|
771
|
-
protected onApiNavigationChanged(
|
|
771
|
+
protected onApiNavigationChanged(): void {
|
|
772
772
|
const specBasedReference = this.isSpecBasedReference(
|
|
773
773
|
this._currentReferenceId
|
|
774
774
|
);
|
|
@@ -854,7 +854,7 @@ export default class AmfReference extends LightningElement {
|
|
|
854
854
|
const urlPath = referenceUrl.substring(
|
|
855
855
|
indexOfQueryParam >= 0 ? indexOfQueryParam : referenceUrl.length
|
|
856
856
|
);
|
|
857
|
-
return this.parseParams(urlPath)
|
|
857
|
+
return this.parseParams(urlPath).meta as string;
|
|
858
858
|
}
|
|
859
859
|
|
|
860
860
|
/**
|
|
@@ -883,6 +883,7 @@ export default class AmfReference extends LightningElement {
|
|
|
883
883
|
* For markdown based references gets topicId as last html path in the name, meta & type will be empty
|
|
884
884
|
*/
|
|
885
885
|
getReferenceMetaInfo(referenceUrl: string): RouteMeta | undefined {
|
|
886
|
+
let metaReferenceInfo;
|
|
886
887
|
if (referenceUrl) {
|
|
887
888
|
const referenceId = this.getReferenceIdFromUrl(referenceUrl);
|
|
888
889
|
let meta = "";
|
|
@@ -902,13 +903,14 @@ export default class AmfReference extends LightningElement {
|
|
|
902
903
|
} else {
|
|
903
904
|
topicId = this.getMarkdownReferenceMeta(referenceUrl);
|
|
904
905
|
}
|
|
905
|
-
|
|
906
|
+
metaReferenceInfo = {
|
|
906
907
|
referenceId,
|
|
907
908
|
meta,
|
|
908
909
|
topicId,
|
|
909
910
|
type
|
|
910
911
|
};
|
|
911
912
|
}
|
|
913
|
+
return metaReferenceInfo;
|
|
912
914
|
}
|
|
913
915
|
|
|
914
916
|
/**
|
|
@@ -946,10 +948,12 @@ export default class AmfReference extends LightningElement {
|
|
|
946
948
|
topicMeta: string
|
|
947
949
|
): string | undefined {
|
|
948
950
|
const amfConfig = this.getAmfConfigWithId(referenceId);
|
|
951
|
+
let referenceUrl;
|
|
949
952
|
if (amfConfig) {
|
|
950
953
|
const topics = amfConfig.topic?.children || [];
|
|
951
|
-
|
|
954
|
+
referenceUrl = this.getReferenceUrlInGivenTopics(topics, topicMeta);
|
|
952
955
|
}
|
|
956
|
+
return referenceUrl;
|
|
953
957
|
}
|
|
954
958
|
|
|
955
959
|
/**
|
|
@@ -1045,7 +1049,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1045
1049
|
const referenceId = this.getReferenceIdFromUrl(url);
|
|
1046
1050
|
const referenceItem = this.getAmfConfigWithId(referenceId);
|
|
1047
1051
|
if (referenceItem) {
|
|
1048
|
-
location.href = referenceItem.href;
|
|
1052
|
+
window.location.href = referenceItem.href;
|
|
1049
1053
|
}
|
|
1050
1054
|
}
|
|
1051
1055
|
|
|
@@ -1105,7 +1109,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1105
1109
|
if (redirectReferenceUrl) {
|
|
1106
1110
|
if (this.isParentReferencePath(referenceUrl)) {
|
|
1107
1111
|
// This is for CASE2 mentioned above, Where we need to navigate user to respective href
|
|
1108
|
-
location.href = redirectReferenceUrl;
|
|
1112
|
+
window.location.href = redirectReferenceUrl;
|
|
1109
1113
|
} else {
|
|
1110
1114
|
// This is for CASE 1,3 and 4 mentioned above, Where we need to update the browser history
|
|
1111
1115
|
window.history.replaceState({}, "", redirectReferenceUrl);
|
|
@@ -1133,8 +1137,8 @@ export default class AmfReference extends LightningElement {
|
|
|
1133
1137
|
onNavSelect(event: CustomEvent): void {
|
|
1134
1138
|
const name = event.detail.name;
|
|
1135
1139
|
if (name) {
|
|
1136
|
-
const
|
|
1137
|
-
const specBasedReference = this.isSpecBasedReference(
|
|
1140
|
+
const urlReferenceId = this.getReferenceIdFromUrl(name);
|
|
1141
|
+
const specBasedReference = this.isSpecBasedReference(urlReferenceId);
|
|
1138
1142
|
if (specBasedReference) {
|
|
1139
1143
|
const metaVal = this.getMetaFromUrl(name);
|
|
1140
1144
|
const currentSelectedMeta = this.selectedTopic
|
|
@@ -202,7 +202,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
202
202
|
for (const headingElement of headingElements) {
|
|
203
203
|
// Sometimes elements hash is not being set when slot content is wrapped with div
|
|
204
204
|
headingElement.hash =
|
|
205
|
-
headingElement.attributes
|
|
205
|
+
headingElement.attributes.hash?.nodeValue;
|
|
206
206
|
}
|
|
207
207
|
const tocOptions = [];
|
|
208
208
|
for (const headingElement of headingElements) {
|
|
@@ -228,6 +228,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
// eslint-disable-next-line no-undef
|
|
231
232
|
private scrollToHash(headingElements: NodeListOf<Element>): void {
|
|
232
233
|
let { hash } = window.location;
|
|
233
234
|
if (hash) {
|