@salesforcedevs/docs-components 1.3.124-old-version-banner-7 → 1.3.127-alpha.0
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 +1 -1
- package/src/modules/doc/amfReference/amfReference.css +0 -15
- package/src/modules/doc/amfReference/amfReference.html +0 -7
- package/src/modules/doc/amfReference/amfReference.ts +24 -23
- package/src/modules/doc/amfReference/types.ts +10 -2
- package/src/modules/doc/content/content.css +7 -0
- package/src/modules/doc/contentLayout/contentLayout.css +7 -0
- package/src/modules/doc/contentLayout/contentLayout.html +0 -1
- package/src/modules/doc/contentLayout/contentLayout.ts +16 -1
- package/src/modules/doc/overview/overview.html +1 -0
- package/src/modules/doc/phase/phase.css +7 -7
- package/src/modules/doc/phase/phase.html +6 -15
- package/src/modules/doc/phase/phase.ts +12 -44
- package/src/modules/doc/xmlContent/types.ts +0 -3
- package/src/modules/doc/xmlContent/xmlContent.css +0 -6
- package/src/modules/doc/xmlContent/xmlContent.html +0 -8
- package/src/modules/doc/xmlContent/xmlContent.ts +2 -59
- package/src/modules/docUtils/utils/utils.ts +0 -7
package/package.json
CHANGED
|
@@ -4,21 +4,6 @@ doc-phase {
|
|
|
4
4
|
);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
/* We need to apply some borders when there are two doc phases */
|
|
8
|
-
doc-phase:not(:only-child):first-child::part(container) {
|
|
9
|
-
border-top: 1px solid #f9e3b6 !important;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
doc-phase:nth-child(2)::part(container) {
|
|
13
|
-
border-top: 1px solid #f9e3b6 !important;
|
|
14
|
-
border-bottom: 1px solid #f9e3b6 !important;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* We don't want second component to sticky as we need to handle different cases like position */
|
|
18
|
-
doc-phase:nth-child(2) {
|
|
19
|
-
position: static;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
7
|
.api-documentation {
|
|
23
8
|
margin-top: 48px;
|
|
24
9
|
}
|
|
@@ -21,13 +21,6 @@
|
|
|
21
21
|
if:true={docPhaseInfo}
|
|
22
22
|
doc-phase-info={docPhaseInfo}
|
|
23
23
|
></doc-phase>
|
|
24
|
-
<doc-phase
|
|
25
|
-
slot="version-banner"
|
|
26
|
-
if:true={oldVersionInfo}
|
|
27
|
-
doc-phase-info={oldVersionInfo}
|
|
28
|
-
dismissible="true"
|
|
29
|
-
icon-name="warning"
|
|
30
|
-
></doc-phase>
|
|
31
24
|
<div slot="sidebar-header" class="version-picker">
|
|
32
25
|
<template if:true={isVersionEnabled}>
|
|
33
26
|
<dx-dropdown
|
|
@@ -48,13 +48,6 @@ export default class AmfReference extends LightningElement {
|
|
|
48
48
|
return !!this._referenceSetConfig?.versions?.length;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
/*TODO: Get the info based on logic*/
|
|
52
|
-
@api oldVersionInfo = {
|
|
53
|
-
title: "Newer Version Available",
|
|
54
|
-
body: `This content describes an older version of this product. <a style="font-weight: bold;" href="https://developer.salesforce.com/">
|
|
55
|
-
View Latest</a>`
|
|
56
|
-
};
|
|
57
|
-
|
|
58
51
|
/**
|
|
59
52
|
* Gives if the currently selected reference is spec based or not
|
|
60
53
|
*/
|
|
@@ -174,10 +167,12 @@ export default class AmfReference extends LightningElement {
|
|
|
174
167
|
constructor() {
|
|
175
168
|
super();
|
|
176
169
|
|
|
177
|
-
this._boundOnApiNavigationChanged =
|
|
178
|
-
this
|
|
179
|
-
|
|
180
|
-
|
|
170
|
+
this._boundOnApiNavigationChanged = this.onApiNavigationChanged.bind(
|
|
171
|
+
this
|
|
172
|
+
);
|
|
173
|
+
this._boundUpdateSelectedItemFromUrlQuery = this.updateSelectedItemFromUrlQuery.bind(
|
|
174
|
+
this
|
|
175
|
+
);
|
|
181
176
|
}
|
|
182
177
|
|
|
183
178
|
connectedCallback(): void {
|
|
@@ -233,8 +228,9 @@ export default class AmfReference extends LightningElement {
|
|
|
233
228
|
const updatedReferenceId =
|
|
234
229
|
oldReferenceIdNewReferenceIdMap[referenceId];
|
|
235
230
|
const newReferenceId = updatedReferenceId || referenceId;
|
|
236
|
-
const referenceItemConfig =
|
|
237
|
-
|
|
231
|
+
const referenceItemConfig = this.getAmfConfigWithId(
|
|
232
|
+
newReferenceId
|
|
233
|
+
);
|
|
238
234
|
if (referenceItemConfig) {
|
|
239
235
|
hashBasedRedirectUrl = `${referenceItemConfig.href}?meta=${encodedMeta}`;
|
|
240
236
|
}
|
|
@@ -303,8 +299,9 @@ export default class AmfReference extends LightningElement {
|
|
|
303
299
|
for (let i = 0; i < allVersions.length; i++) {
|
|
304
300
|
const versionItem = allVersions[i];
|
|
305
301
|
const referenceLink = versionItem.link.href;
|
|
306
|
-
const referenceId =
|
|
307
|
-
|
|
302
|
+
const referenceId = this.getReferenceIdFromUrl(
|
|
303
|
+
referenceLink
|
|
304
|
+
);
|
|
308
305
|
if (this._currentReferenceId === referenceId) {
|
|
309
306
|
// This is to navigate to respective topic in the changed version
|
|
310
307
|
versionItem.link.href = `${referenceLink}/${currentRefMeta}`;
|
|
@@ -1229,10 +1226,12 @@ export default class AmfReference extends LightningElement {
|
|
|
1229
1226
|
}
|
|
1230
1227
|
if (!isRedirecting) {
|
|
1231
1228
|
const currentReferenceUrl = window.location.href;
|
|
1232
|
-
const referenceMeta =
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1229
|
+
const referenceMeta = this.getMarkdownReferenceMeta(
|
|
1230
|
+
currentReferenceUrl
|
|
1231
|
+
);
|
|
1232
|
+
const selectedItemRefId = this.getReferenceIdFromUrl(
|
|
1233
|
+
currentReferenceUrl
|
|
1234
|
+
);
|
|
1236
1235
|
const referenceDetails = this.getRefDetailsForGivenTopicMeta(
|
|
1237
1236
|
selectedItemRefId,
|
|
1238
1237
|
referenceMeta
|
|
@@ -1271,8 +1270,9 @@ export default class AmfReference extends LightningElement {
|
|
|
1271
1270
|
const name = event.detail.name;
|
|
1272
1271
|
if (name) {
|
|
1273
1272
|
const urlReferenceId = this.getReferenceIdFromUrl(name);
|
|
1274
|
-
const specBasedReference =
|
|
1275
|
-
|
|
1273
|
+
const specBasedReference = this.isSpecBasedReference(
|
|
1274
|
+
urlReferenceId
|
|
1275
|
+
);
|
|
1276
1276
|
if (specBasedReference) {
|
|
1277
1277
|
const metaVal = this.getMetaFromUrl(name);
|
|
1278
1278
|
const currentSelectedMeta = this.selectedTopic
|
|
@@ -1322,8 +1322,9 @@ export default class AmfReference extends LightningElement {
|
|
|
1322
1322
|
const currentReferenceId = this.getReferenceIdFromUrl(currentUrl);
|
|
1323
1323
|
//No need to do anything if user is expanding currently selected reference
|
|
1324
1324
|
if (referenceId !== currentReferenceId) {
|
|
1325
|
-
const isSpecBasedReference =
|
|
1326
|
-
|
|
1325
|
+
const isSpecBasedReference = this.isSpecBasedReference(
|
|
1326
|
+
referenceId
|
|
1327
|
+
);
|
|
1327
1328
|
if (isSpecBasedReference) {
|
|
1328
1329
|
// Perform functionality same as item selection
|
|
1329
1330
|
this.onNavSelect(event);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Json
|
|
1
|
+
import { Json } from "typings/custom";
|
|
2
2
|
|
|
3
3
|
export interface AmfTopicType {
|
|
4
4
|
referenceId: string;
|
|
@@ -46,6 +46,14 @@ export interface AmfModelRecord {
|
|
|
46
46
|
parsedModel: Json;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export type DocPhase = "pilot" | "dev-preview" | "beta";
|
|
50
|
+
|
|
51
|
+
export type DocPhaseEntry = {
|
|
52
|
+
phase: DocPhase;
|
|
53
|
+
title: string;
|
|
54
|
+
body: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
49
57
|
export type ReferenceType = "markdown" | "rest-raml" | "rest-oa2" | "rest-oa3";
|
|
50
58
|
|
|
51
59
|
/**
|
|
@@ -65,7 +73,7 @@ export interface ParsedMarkdownTopic {
|
|
|
65
73
|
export interface AmfConfig {
|
|
66
74
|
id: string;
|
|
67
75
|
version?: string;
|
|
68
|
-
docPhase?:
|
|
76
|
+
docPhase?: DocPhaseEntry;
|
|
69
77
|
title: string;
|
|
70
78
|
href: string;
|
|
71
79
|
referenceType: ReferenceType;
|
|
@@ -402,3 +402,10 @@ samp,
|
|
|
402
402
|
mark {
|
|
403
403
|
background-color: var(--dx-g-yellow-vibrant-90);
|
|
404
404
|
}
|
|
405
|
+
|
|
406
|
+
/* offset page jump link due to fixed header */
|
|
407
|
+
[id] {
|
|
408
|
+
scroll-margin-top: calc(
|
|
409
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
410
|
+
);
|
|
411
|
+
}
|
|
@@ -40,6 +40,13 @@ dx-toc {
|
|
|
40
40
|
display: block;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/* offset page jump link due to fixed header */
|
|
44
|
+
::slotted(doc-heading) {
|
|
45
|
+
scroll-margin-top: calc(
|
|
46
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
.content {
|
|
44
51
|
display: flex;
|
|
45
52
|
position: relative;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @lwc/lwc/no-document-query */
|
|
1
2
|
import { LightningElement, api, track } from "lwc";
|
|
2
3
|
import { closest } from "kagekiri";
|
|
3
4
|
import { toJson } from "dxUtils/normalizers";
|
|
@@ -204,7 +205,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
204
205
|
const docHeaderEl = document.querySelector(
|
|
205
206
|
".sticky-doc-header"
|
|
206
207
|
) as HTMLElement;
|
|
207
|
-
|
|
208
|
+
|
|
209
|
+
const docPhaseEl = this.template
|
|
210
|
+
.querySelector("[name=doc-phase]")!
|
|
211
|
+
.assignedElements()[0] as HTMLSlotElement;
|
|
208
212
|
|
|
209
213
|
if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
|
|
210
214
|
console.warn("One or more required elements are missing.");
|
|
@@ -237,6 +241,17 @@ export default class ContentLayout extends LightningElement {
|
|
|
237
241
|
: globalNavHeight + docHeaderHeight
|
|
238
242
|
}px`
|
|
239
243
|
);
|
|
244
|
+
|
|
245
|
+
const rightNavBarEl =
|
|
246
|
+
this.template.querySelector(".right-nav-bar");
|
|
247
|
+
|
|
248
|
+
if (rightNavBarEl) {
|
|
249
|
+
rightNavBarEl.style.top = `${
|
|
250
|
+
globalNavHeight +
|
|
251
|
+
docHeaderHeight +
|
|
252
|
+
docPhaseEl.offsetHeight
|
|
253
|
+
}px`;
|
|
254
|
+
}
|
|
240
255
|
}
|
|
241
256
|
});
|
|
242
257
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
6
|
--doc-c-phase-top: 0;
|
|
7
|
+
--doc-c-phase-container-align-items: flex-start;
|
|
7
8
|
|
|
8
9
|
position: sticky;
|
|
9
10
|
top: var(--doc-c-phase-top);
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
.doc-phase-container {
|
|
16
17
|
display: flex;
|
|
17
18
|
flex-direction: column;
|
|
18
|
-
align-items:
|
|
19
|
+
align-items: var(--doc-c-phase-container-align-items);
|
|
19
20
|
padding-left: var(--dx-g-global-header-padding-horizontal);
|
|
20
21
|
padding-right: var(--dx-g-global-header-padding-horizontal);
|
|
21
22
|
width: 100%;
|
|
@@ -23,6 +24,10 @@
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.max-width-container {
|
|
27
|
+
max-width: var(--dx-g-doc-content-body-max-width);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.doc-phase-max-width-large .max-width-container {
|
|
26
31
|
max-width: var(--dx-g-doc-content-max-width);
|
|
27
32
|
}
|
|
28
33
|
|
|
@@ -36,7 +41,7 @@ dx-button {
|
|
|
36
41
|
margin-left: auto;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
/*
|
|
44
|
+
/*
|
|
40
45
|
NOTE: Here we are assuming that indicator height won't go beyond 1000px.
|
|
41
46
|
|
|
42
47
|
It's one of the suggested way to achieve the expand/collapse animation
|
|
@@ -64,11 +69,6 @@ dx-button {
|
|
|
64
69
|
color: var(--dx-g-blue-vibrant-50);
|
|
65
70
|
}
|
|
66
71
|
|
|
67
|
-
.dismissible-icon {
|
|
68
|
-
margin-left: auto;
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
72
|
/* Small Devices */
|
|
73
73
|
@media screen and (max-width: 480px) {
|
|
74
74
|
.doc-phase-container {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div class="doc-phase-title-container">
|
|
5
5
|
<dx-icon
|
|
6
6
|
class="doc-status-icon doc-phase-icon"
|
|
7
|
-
symbol=
|
|
7
|
+
symbol="recipe"
|
|
8
8
|
size="large"
|
|
9
9
|
color="status-icon-color"
|
|
10
10
|
></dx-icon>
|
|
@@ -12,27 +12,18 @@
|
|
|
12
12
|
{docPhaseTitle}
|
|
13
13
|
</p>
|
|
14
14
|
<dx-button
|
|
15
|
-
if:false={dismissible}
|
|
16
15
|
variant="inline"
|
|
17
|
-
onclick={
|
|
16
|
+
onclick={onButtonClick}
|
|
18
17
|
aria-label={hideBodyText}
|
|
19
18
|
>
|
|
20
19
|
{hideBodyText}
|
|
21
20
|
</dx-button>
|
|
22
|
-
<dx-icon
|
|
23
|
-
if:true={dismissible}
|
|
24
|
-
class="dismissible-icon"
|
|
25
|
-
onclick={onDismiss}
|
|
26
|
-
symbol="close"
|
|
27
|
-
size="large"
|
|
28
|
-
color="status-icon-color"
|
|
29
|
-
></dx-icon>
|
|
30
21
|
</div>
|
|
31
22
|
<!--
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
NOTE: Here we are rendering mark up using lwc:dom & innerHTML
|
|
24
|
+
option instead of slots because the html markup will come as a
|
|
25
|
+
property to the component from a configuration
|
|
26
|
+
-->
|
|
36
27
|
<span lwc:dom="manual" class={bodyClassName}></span>
|
|
37
28
|
</div>
|
|
38
29
|
</div>
|
|
@@ -2,48 +2,27 @@ import { LightningElement, api } from "lwc";
|
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
|
|
4
4
|
import { DocPhaseInfo } from "typings/custom";
|
|
5
|
-
import { toJson
|
|
5
|
+
import { toJson } from "dxUtils/normalizers";
|
|
6
6
|
|
|
7
7
|
export default class Phase extends LightningElement {
|
|
8
8
|
_docPhaseInfo: DocPhaseInfo | null = null;
|
|
9
|
-
_dismissible = false;
|
|
10
|
-
_iconName = "recipe";
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
get docPhaseInfo(): DocPhaseInfo | null {
|
|
14
|
-
return this._docPhaseInfo;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
set docPhaseInfo(value) {
|
|
18
|
-
this._docPhaseInfo = toJson(value);
|
|
19
|
-
}
|
|
10
|
+
isBodyHidden = false;
|
|
20
11
|
|
|
21
12
|
@api
|
|
22
|
-
|
|
23
|
-
return this._dismissible;
|
|
24
|
-
}
|
|
13
|
+
maxWidthSize: "small" | "large" = "small";
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this._dismissible = normalizeBoolean(value);
|
|
29
|
-
}
|
|
15
|
+
get docPhaseTitle() {
|
|
16
|
+
return this.docPhaseInfo?.title;
|
|
30
17
|
}
|
|
31
18
|
|
|
32
19
|
@api
|
|
33
|
-
get
|
|
34
|
-
return this.
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
set iconName(value) {
|
|
38
|
-
if (value) {
|
|
39
|
-
this._iconName = value;
|
|
40
|
-
}
|
|
20
|
+
get docPhaseInfo(): DocPhaseInfo | null {
|
|
21
|
+
return this._docPhaseInfo;
|
|
41
22
|
}
|
|
42
23
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
get docPhaseTitle() {
|
|
46
|
-
return this.docPhaseInfo?.title;
|
|
24
|
+
set docPhaseInfo(value) {
|
|
25
|
+
this._docPhaseInfo = toJson(value);
|
|
47
26
|
}
|
|
48
27
|
|
|
49
28
|
get hideBodyText() {
|
|
@@ -54,7 +33,8 @@ export default class Phase extends LightningElement {
|
|
|
54
33
|
return cx(
|
|
55
34
|
"doc-status-base",
|
|
56
35
|
"doc-status-container",
|
|
57
|
-
"doc-phase-container"
|
|
36
|
+
"doc-phase-container",
|
|
37
|
+
`doc-phase-max-width-${this.maxWidthSize}`
|
|
58
38
|
);
|
|
59
39
|
}
|
|
60
40
|
|
|
@@ -75,19 +55,7 @@ export default class Phase extends LightningElement {
|
|
|
75
55
|
}
|
|
76
56
|
}
|
|
77
57
|
|
|
78
|
-
|
|
58
|
+
onButtonClick() {
|
|
79
59
|
this.isBodyHidden = !this.isBodyHidden;
|
|
80
60
|
}
|
|
81
|
-
|
|
82
|
-
onDismiss() {
|
|
83
|
-
this.dispatchEvent(
|
|
84
|
-
new CustomEvent("dismissphase", {
|
|
85
|
-
detail: {
|
|
86
|
-
docPhaseInfo: this.docPhaseInfo
|
|
87
|
-
},
|
|
88
|
-
composed: true,
|
|
89
|
-
bubbles: true
|
|
90
|
-
})
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
61
|
}
|
|
@@ -11,14 +11,6 @@
|
|
|
11
11
|
onselect={handleSelect}
|
|
12
12
|
use-old-sidebar={useOldSidebar}
|
|
13
13
|
>
|
|
14
|
-
<doc-phase
|
|
15
|
-
slot="version-banner"
|
|
16
|
-
if:true={showVersionBanner}
|
|
17
|
-
doc-phase-info={oldVersionInfo}
|
|
18
|
-
icon-name="warning"
|
|
19
|
-
dismissible="true"
|
|
20
|
-
ondismissphase={handleDismissVersionBanner}
|
|
21
|
-
></doc-phase>
|
|
22
14
|
<div slot="sidebar-header" class="document-pickers">
|
|
23
15
|
<dx-dropdown
|
|
24
16
|
data-type="version"
|
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
} from "./types";
|
|
15
15
|
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
16
16
|
import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
|
|
17
|
-
import {
|
|
18
|
-
import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
|
|
17
|
+
import { Breadcrumb, Language } from "typings/custom";
|
|
19
18
|
|
|
20
19
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
21
20
|
const handleContentError = (error): void => console.log(error);
|
|
@@ -109,33 +108,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
109
108
|
});
|
|
110
109
|
private _allLanguages: Array<Language> = [];
|
|
111
110
|
|
|
112
|
-
private get oldVersionInfo(): DocPhaseInfo | null {
|
|
113
|
-
let info = null;
|
|
114
|
-
if (!this.disableVersion) {
|
|
115
|
-
const currentGAVersion = this.versionOptions.find(
|
|
116
|
-
(version) => !version.url.includes(version.id)
|
|
117
|
-
);
|
|
118
|
-
if (currentGAVersion?.link?.href && this.version?.id) {
|
|
119
|
-
const versionNo = currentGAVersion.id;
|
|
120
|
-
/**
|
|
121
|
-
* Need to show old version doc banner only if the version is less than the current ga version
|
|
122
|
-
* We should not show it to the preview version whose version is more than ga
|
|
123
|
-
**/
|
|
124
|
-
try {
|
|
125
|
-
if (parseFloat(this.version.id) < parseFloat(versionNo)) {
|
|
126
|
-
info = oldVersionDocInfo(currentGAVersion.link.href);
|
|
127
|
-
}
|
|
128
|
-
} catch (exception) {
|
|
129
|
-
/* Ideally this use case should not happen, but just added to not to break the page*/
|
|
130
|
-
console.warn(exception);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return info;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@track showVersionBanner = false;
|
|
138
|
-
|
|
139
111
|
@track private pageReference: PageReference = {};
|
|
140
112
|
@track breadcrumbs: Array<Breadcrumb> = [];
|
|
141
113
|
|
|
@@ -184,28 +156,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
184
156
|
));
|
|
185
157
|
|
|
186
158
|
if (anchorEl) {
|
|
187
|
-
|
|
188
|
-
".global-nav-container"
|
|
189
|
-
) as HTMLElement;
|
|
190
|
-
const docHeader = document.querySelector(
|
|
191
|
-
"doc-header"
|
|
192
|
-
) as HTMLElement;
|
|
193
|
-
const headerHeight = globalNavHeader.offsetHeight;
|
|
194
|
-
const docHeaderHeight = docHeader.offsetHeight;
|
|
195
|
-
const rect = anchorEl.getBoundingClientRect();
|
|
196
|
-
|
|
197
|
-
// Calculate the scroll position required to bring the element into view
|
|
198
|
-
const scrollTop =
|
|
199
|
-
window.pageYOffset || document.documentElement.scrollTop;
|
|
200
|
-
const scrollX = rect.left + window.pageXOffset;
|
|
201
|
-
const scrollY =
|
|
202
|
-
rect.top + scrollTop - (headerHeight + docHeaderHeight); // subtract the header height from the top position
|
|
203
|
-
|
|
204
|
-
// Scroll to the calculated position
|
|
205
|
-
window.scrollTo({
|
|
206
|
-
top: scrollY,
|
|
207
|
-
left: scrollX
|
|
208
|
-
});
|
|
159
|
+
anchorEl.scrollIntoView();
|
|
209
160
|
|
|
210
161
|
this.setState({ internalLinkClicked: false });
|
|
211
162
|
}
|
|
@@ -342,10 +293,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
342
293
|
private handlePopState = (event: PopStateEvent): void =>
|
|
343
294
|
this.updatePageReference(this.getReferenceFromUrl(), event);
|
|
344
295
|
|
|
345
|
-
handleDismissVersionBanner() {
|
|
346
|
-
this.showVersionBanner = false;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
296
|
handleSelect(event: CustomEvent<{ name: string }>): void {
|
|
350
297
|
event.stopPropagation();
|
|
351
298
|
const { name } = event.detail;
|
|
@@ -477,10 +424,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
477
424
|
this.updateUrl(HistoryState.REPLACE_STATE);
|
|
478
425
|
}
|
|
479
426
|
|
|
480
|
-
if (this.oldVersionInfo) {
|
|
481
|
-
this.showVersionBanner = true;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
427
|
if (
|
|
485
428
|
this.pageReference?.contentDocumentId?.replace(/\.htm$/, "") !==
|
|
486
429
|
data.id
|