@salesforcedevs/docs-components 1.34.3-fix-redoc-topic-v-1 → 1.34.3-fix-redoc-topic-v-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
|
@@ -288,15 +288,26 @@ export default class RedocReference extends LightningElement {
|
|
|
288
288
|
return stored;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
let targetUrl: URL;
|
|
292
|
+
try {
|
|
293
|
+
targetUrl = new URL(target, window.location.origin);
|
|
294
|
+
} catch {
|
|
295
|
+
return target;
|
|
296
|
+
}
|
|
297
|
+
|
|
291
298
|
// Family hrefs match this page's version. Compare them without
|
|
292
|
-
// the version segment.
|
|
299
|
+
// the version segment. Rewrite only the pathname so the target's
|
|
300
|
+
// query and hash survive.
|
|
293
301
|
const familyHrefs = this._parentTopicFamilyNode
|
|
294
302
|
? collectSubtreeCanonicalHrefs(this._parentTopicFamilyNode).map(
|
|
295
303
|
(href) => toCanonicalHref(href, this.versions)
|
|
296
304
|
)
|
|
297
305
|
: [];
|
|
298
306
|
|
|
299
|
-
const canonicalTarget = toCanonicalHref(
|
|
307
|
+
const canonicalTarget = toCanonicalHref(
|
|
308
|
+
targetUrl.pathname,
|
|
309
|
+
this.versions
|
|
310
|
+
);
|
|
300
311
|
const inFamily = familyHrefs.some(
|
|
301
312
|
(href) => normalizePath(href) === normalizePath(canonicalTarget)
|
|
302
313
|
);
|
|
@@ -304,13 +315,15 @@ export default class RedocReference extends LightningElement {
|
|
|
304
315
|
return target;
|
|
305
316
|
}
|
|
306
317
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.versions
|
|
312
|
-
) ?? target
|
|
318
|
+
const versioned = applyVersionToHref(
|
|
319
|
+
canonicalTarget,
|
|
320
|
+
selectedVersion,
|
|
321
|
+
this.versions
|
|
313
322
|
);
|
|
323
|
+
if (!versioned) {
|
|
324
|
+
return target;
|
|
325
|
+
}
|
|
326
|
+
return `${versioned}${targetUrl.search}${targetUrl.hash}`;
|
|
314
327
|
}
|
|
315
328
|
|
|
316
329
|
private getTranslatedBackTarget(): string | null {
|