@salesforcedevs/docs-components 1.3.171-alpha.0 → 1.3.172
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/LICENSE +12 -0
- package/package.json +2 -2
- package/src/modules/doc/amfReference/amfReference.ts +61 -80
- package/src/modules/doc/amfReference/utils.ts +5 -10
- package/src/modules/doc/amfTopic/amfTopic.ts +7 -12
- package/src/modules/doc/amfTopic/types.ts +12 -14
- package/src/modules/doc/amfTopic/utils.ts +6 -12
- package/src/modules/doc/content/content.css +0 -21
- package/src/modules/doc/content/content.ts +11 -10
- package/src/modules/doc/contentLayout/contentLayout.ts +34 -38
- package/src/modules/doc/heading/heading.ts +0 -2
- package/src/modules/doc/toc/toc.ts +1 -1
- package/src/modules/doc/xmlContent/types.ts +1 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +38 -43
- package/src/modules/docHelpers/imgStyle/imgStyle.css +12 -16
- package/src/modules/docUtils/SearchSyncer/SearchSyncer.ts +85 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @lwc/lwc/no-inner-html */
|
|
2
2
|
import { createElement, LightningElement, api, track } from "lwc";
|
|
3
3
|
import { DocContent, PageReference } from "typings/custom";
|
|
4
|
+
import ContentCallout from "doc/contentCallout";
|
|
4
5
|
import CodeBlock from "dx/codeBlock";
|
|
6
|
+
import ContentMedia from "doc/contentMedia";
|
|
5
7
|
import Button from "dx/button";
|
|
6
8
|
import { highlightTerms } from "dxUtils/highlight";
|
|
7
|
-
import ContentCallout from "doc/contentCallout";
|
|
8
|
-
import ContentMedia from "doc/contentMedia";
|
|
9
9
|
|
|
10
10
|
const HIGHLIGHTABLE_SELECTOR = [
|
|
11
11
|
"p",
|
|
@@ -86,7 +86,7 @@ export default class Content extends LightningElement {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
renderPaginationButton(anchorEl: HTMLElement) {
|
|
89
|
-
const isNext = anchorEl.textContent
|
|
89
|
+
const isNext = anchorEl.textContent.includes("Next →");
|
|
90
90
|
anchorEl.innerHTML = "";
|
|
91
91
|
const buttonEl = createElement("dx-button", { is: Button });
|
|
92
92
|
const params = isNext
|
|
@@ -116,7 +116,7 @@ export default class Content extends LightningElement {
|
|
|
116
116
|
const codeBlockEls = divEl.querySelectorAll(".codeSection");
|
|
117
117
|
codeBlockEls.forEach((codeBlockEl) => {
|
|
118
118
|
codeBlockEl.setAttribute("lwc:dom", "manual");
|
|
119
|
-
const classList =
|
|
119
|
+
const classList = codeBlockEl.firstChild.classList;
|
|
120
120
|
let language = "";
|
|
121
121
|
for (const key in classList) {
|
|
122
122
|
if (typeof classList[key] === "string") {
|
|
@@ -160,7 +160,7 @@ export default class Content extends LightningElement {
|
|
|
160
160
|
|
|
161
161
|
let flag = 1;
|
|
162
162
|
for (let i: number = 0; i < detailEls.length; i++) {
|
|
163
|
-
flag &=
|
|
163
|
+
flag &= detailEls[i].innerHTML.trim() === "";
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
if (flag) {
|
|
@@ -170,7 +170,7 @@ export default class Content extends LightningElement {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
const type = calloutEl.querySelector("h4")
|
|
173
|
+
const type = calloutEl.querySelector("h4").textContent;
|
|
174
174
|
const typeLower = type.toLowerCase();
|
|
175
175
|
Object.assign(calloutCompEl, {
|
|
176
176
|
title: type,
|
|
@@ -184,10 +184,10 @@ export default class Content extends LightningElement {
|
|
|
184
184
|
// Modify links to work with any domain, links that start with "#" are excluded
|
|
185
185
|
const anchorEls = divEl.querySelectorAll("a:not([href^='#'])");
|
|
186
186
|
|
|
187
|
-
anchorEls.forEach((anchorEl
|
|
187
|
+
anchorEls.forEach((anchorEl) => {
|
|
188
188
|
if (
|
|
189
|
-
anchorEl.textContent
|
|
190
|
-
anchorEl.textContent
|
|
189
|
+
anchorEl.textContent.includes("Next →") ||
|
|
190
|
+
anchorEl.textContent.includes("← Previous")
|
|
191
191
|
) {
|
|
192
192
|
if (this.showPaginationButtons) {
|
|
193
193
|
this.renderPaginationButton(anchorEl);
|
|
@@ -326,7 +326,8 @@ export default class Content extends LightningElement {
|
|
|
326
326
|
|
|
327
327
|
handleNavClick(event: InputEvent) {
|
|
328
328
|
event.preventDefault();
|
|
329
|
-
|
|
329
|
+
// eslint-disable-next-line no-use-before-define
|
|
330
|
+
const target = event.currentTarget.dataset.id;
|
|
330
331
|
const [page, docId, deliverable, tempContentDocumentId] =
|
|
331
332
|
target.split("/");
|
|
332
333
|
const [contentDocumentId, hash] = tempContentDocumentId.split("#");
|
|
@@ -3,7 +3,7 @@ import { LightningElement, api, track } from "lwc";
|
|
|
3
3
|
import { closest } from "kagekiri";
|
|
4
4
|
import { toJson } from "dxUtils/normalizers";
|
|
5
5
|
import { highlightTerms } from "dxUtils/highlight";
|
|
6
|
-
import { SearchSyncer } from "docUtils/
|
|
6
|
+
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
7
7
|
|
|
8
8
|
type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
|
|
9
9
|
|
|
@@ -26,9 +26,9 @@ const HIGHLIGHTABLE_SELECTOR = [
|
|
|
26
26
|
export const OBSERVER_ATTACH_WAIT_TIME = 500;
|
|
27
27
|
|
|
28
28
|
export default class ContentLayout extends LightningElement {
|
|
29
|
-
@api sidebarValue
|
|
30
|
-
@api sidebarHeader
|
|
31
|
-
@api tocTitle
|
|
29
|
+
@api sidebarValue: string;
|
|
30
|
+
@api sidebarHeader: string;
|
|
31
|
+
@api tocTitle: string;
|
|
32
32
|
@api enableSlotChange = false;
|
|
33
33
|
@api coveoOrganizationId!: string;
|
|
34
34
|
@api coveoPublicAccessToken!: string;
|
|
@@ -41,7 +41,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
41
41
|
return this._breadcrumbs;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
set breadcrumbs(value) {
|
|
44
|
+
set breadcrumbs(value): [] {
|
|
45
45
|
if (value) {
|
|
46
46
|
this._breadcrumbs = toJson(value);
|
|
47
47
|
}
|
|
@@ -52,7 +52,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
52
52
|
return this._sidebarContent;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
set sidebarContent(value
|
|
55
|
+
set sidebarContent(value) {
|
|
56
56
|
this._sidebarContent = toJson(value);
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -67,9 +67,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
67
67
|
|
|
68
68
|
@api
|
|
69
69
|
setSidebarInputValue(searchTerm: string): void {
|
|
70
|
-
|
|
71
|
-
searchTerm
|
|
72
|
-
);
|
|
70
|
+
this.template.querySelector("dx-sidebar")?.setInputValue(searchTerm);
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
@track
|
|
@@ -78,11 +76,11 @@ export default class ContentLayout extends LightningElement {
|
|
|
78
76
|
private _breadcrumbs = null;
|
|
79
77
|
|
|
80
78
|
@track
|
|
81
|
-
private _tocOptions
|
|
79
|
+
private _tocOptions: Array<unknown>;
|
|
82
80
|
|
|
83
81
|
private tocOptionIdsSet = new Set();
|
|
84
82
|
private anchoredElements: AnchorMap = {};
|
|
85
|
-
private lastScrollPosition
|
|
83
|
+
private lastScrollPosition: number;
|
|
86
84
|
private observer?: IntersectionObserver;
|
|
87
85
|
private hasRendered: boolean = false;
|
|
88
86
|
private contentLoaded: boolean = false;
|
|
@@ -107,8 +105,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
107
105
|
target: window
|
|
108
106
|
});
|
|
109
107
|
private tocValue?: string = undefined;
|
|
110
|
-
|
|
111
|
-
private observerTimerId?: NodeJS.Timeout;
|
|
108
|
+
private observerTimerId = null;
|
|
112
109
|
private didScrollToSelectedHash = false;
|
|
113
110
|
private _scrollInterval = 0;
|
|
114
111
|
|
|
@@ -206,9 +203,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
206
203
|
".sticky-doc-header"
|
|
207
204
|
) as HTMLElement;
|
|
208
205
|
|
|
209
|
-
const docPhaseEl =
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
const docPhaseEl = this.template
|
|
207
|
+
.querySelector("[name=doc-phase]")!
|
|
208
|
+
.assignedElements()[0] as HTMLSlotElement;
|
|
212
209
|
|
|
213
210
|
if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
|
|
214
211
|
console.warn("One or more required elements are missing.");
|
|
@@ -250,7 +247,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
250
247
|
document.querySelectorAll("doc-heading")
|
|
251
248
|
);
|
|
252
249
|
docHeadingEls.forEach((docHeadingEl) => {
|
|
253
|
-
|
|
250
|
+
docHeadingEl.style.scrollMarginTop = `${
|
|
254
251
|
globalNavHeight +
|
|
255
252
|
docHeaderHeight +
|
|
256
253
|
docPhaseEl.getBoundingClientRect().height
|
|
@@ -258,8 +255,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
258
255
|
});
|
|
259
256
|
|
|
260
257
|
// Adjust right nav bar position when doc phase is present
|
|
261
|
-
const rightNavBarEl =
|
|
262
|
-
|
|
258
|
+
const rightNavBarEl = this.template.querySelector(
|
|
259
|
+
".right-nav-bar"
|
|
260
|
+
);
|
|
263
261
|
|
|
264
262
|
if (rightNavBarEl) {
|
|
265
263
|
rightNavBarEl.style.top = `${
|
|
@@ -293,7 +291,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
293
291
|
entries.forEach(
|
|
294
292
|
(entry) =>
|
|
295
293
|
(this.anchoredElements[
|
|
296
|
-
entry.target.getAttribute("id")
|
|
294
|
+
entry.target.getAttribute("id")
|
|
297
295
|
].intersect = entry.isIntersecting)
|
|
298
296
|
);
|
|
299
297
|
this.calculateActualSection();
|
|
@@ -305,9 +303,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
305
303
|
|
|
306
304
|
// Note: We are doing document.querySelectorAll as a quick fix as we are not getting heading elements reference this.querySelectorAll
|
|
307
305
|
const headingElements = document.querySelectorAll(TOC_HEADER_TAG);
|
|
308
|
-
|
|
306
|
+
|
|
307
|
+
for (const headingElement of headingElements) {
|
|
309
308
|
// Add headingElements to intersectionObserver for highlighting respective RNB item when user scroll
|
|
310
|
-
const id = headingElement.getAttribute("id")
|
|
309
|
+
const id = headingElement.getAttribute("id");
|
|
311
310
|
this.anchoredElements[id] = {
|
|
312
311
|
id,
|
|
313
312
|
intersect: false
|
|
@@ -321,26 +320,23 @@ export default class ContentLayout extends LightningElement {
|
|
|
321
320
|
};
|
|
322
321
|
|
|
323
322
|
onSlotChange(event: Event): void {
|
|
324
|
-
const slotElements = (
|
|
325
|
-
event.target as HTMLSlotElement
|
|
326
|
-
).assignedElements();
|
|
323
|
+
const slotElements = (event.target as HTMLSlotElement).assignedElements();
|
|
327
324
|
|
|
328
325
|
if (slotElements.length) {
|
|
329
326
|
this.contentLoaded = true;
|
|
330
327
|
const slotContentElement = slotElements[0];
|
|
331
|
-
const headingElements =
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
);
|
|
328
|
+
const headingElements = slotContentElement.ownerDocument?.getElementsByTagName(
|
|
329
|
+
TOC_HEADER_TAG
|
|
330
|
+
);
|
|
335
331
|
|
|
336
|
-
for (const headingElement of headingElements
|
|
332
|
+
for (const headingElement of headingElements) {
|
|
337
333
|
// Sometimes elements hash is not being set when slot content is wrapped with div
|
|
338
334
|
headingElement.hash = headingElement.attributes.hash?.nodeValue;
|
|
339
335
|
}
|
|
340
336
|
|
|
341
337
|
const tocOptions = [];
|
|
342
338
|
|
|
343
|
-
for (const headingElement of headingElements
|
|
339
|
+
for (const headingElement of headingElements) {
|
|
344
340
|
headingElement.id = headingElement.hash;
|
|
345
341
|
|
|
346
342
|
// Update tocOptions from anchorTags only for H2, consider default as 2 as per component
|
|
@@ -366,7 +362,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
366
362
|
private disconnectObserver(): void {
|
|
367
363
|
if (this.observer) {
|
|
368
364
|
this.observer.disconnect();
|
|
369
|
-
this.observer =
|
|
365
|
+
this.observer = null;
|
|
370
366
|
}
|
|
371
367
|
}
|
|
372
368
|
|
|
@@ -391,15 +387,15 @@ export default class ContentLayout extends LightningElement {
|
|
|
391
387
|
globalNavEl.offsetHeight +
|
|
392
388
|
contextNavEl.offsetHeight;
|
|
393
389
|
|
|
394
|
-
const docPhaseEl =
|
|
395
|
-
|
|
396
|
-
|
|
390
|
+
const docPhaseEl = this.template
|
|
391
|
+
.querySelector("[name=doc-phase]")!
|
|
392
|
+
.assignedElements()[0] as HTMLSlotElement;
|
|
397
393
|
|
|
398
394
|
const offset = docPhaseEl
|
|
399
395
|
? headerHeight + docPhaseEl.offsetHeight
|
|
400
396
|
: headerHeight;
|
|
401
397
|
|
|
402
|
-
for (const headingElement of headingElements
|
|
398
|
+
for (const headingElement of headingElements) {
|
|
403
399
|
if (headingElement.getAttribute("id") === hash) {
|
|
404
400
|
this.scrollIntoViewWithOffset(headingElement, offset);
|
|
405
401
|
break;
|
|
@@ -436,14 +432,14 @@ export default class ContentLayout extends LightningElement {
|
|
|
436
432
|
this.lastScrollPosition = currentScrollPosition;
|
|
437
433
|
}
|
|
438
434
|
|
|
439
|
-
private calculatePreviousElementId(): string
|
|
435
|
+
private calculatePreviousElementId(): string {
|
|
440
436
|
const keys = Object.keys(this.anchoredElements);
|
|
441
437
|
const currentIndex = keys.findIndex((id) => this.tocValue === id);
|
|
442
438
|
|
|
443
439
|
return currentIndex > 0 ? keys[currentIndex - 1] : undefined;
|
|
444
440
|
}
|
|
445
441
|
|
|
446
|
-
private assignElementId(id: string
|
|
442
|
+
private assignElementId(id: string): void {
|
|
447
443
|
// Change toc(RNB) highlight only for H2
|
|
448
444
|
if (this.tocOptionIdsSet.has(id)) {
|
|
449
445
|
this.tocValue = id;
|
|
@@ -11,14 +11,12 @@ export const ariaLevels = Object.keys(ariaDisplayLevels);
|
|
|
11
11
|
|
|
12
12
|
export const displayLevels = Object.values(ariaDisplayLevels);
|
|
13
13
|
|
|
14
|
-
// @ts-ignore: Really Dark Magic (TM) to do with ariaLevel needing explicit getter/setters
|
|
15
14
|
export default class Heading extends LightningElement {
|
|
16
15
|
@api title: string = "";
|
|
17
16
|
@api hash: string | null = null;
|
|
18
17
|
|
|
19
18
|
@api
|
|
20
19
|
private get ariaLevel(): string {
|
|
21
|
-
// Really Dark Magic (TM)
|
|
22
20
|
return this._ariaLevel || "2";
|
|
23
21
|
}
|
|
24
22
|
private set ariaLevel(value: string | null) {
|
|
@@ -11,7 +11,7 @@ export default class Toc extends LightningElement {
|
|
|
11
11
|
const newPageReference = { ...this.pageReference };
|
|
12
12
|
// When moving to the new navigation component
|
|
13
13
|
//const target = event.detail.name.split('-')
|
|
14
|
-
const target =
|
|
14
|
+
const target = event.currentTarget.dataset.id.split("-");
|
|
15
15
|
newPageReference.contentDocumentId = target[0] + ".htm";
|
|
16
16
|
newPageReference.hash = target[1];
|
|
17
17
|
this.dispatchEvent(
|
|
@@ -12,15 +12,15 @@ import {
|
|
|
12
12
|
PageReference,
|
|
13
13
|
TocMap
|
|
14
14
|
} from "./types";
|
|
15
|
+
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
15
16
|
import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
|
|
16
17
|
import { oldVersionDocInfo } from "docUtils/utils";
|
|
17
18
|
import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
|
|
18
19
|
import { track as trackGTM } from "dxUtils/analytics";
|
|
19
20
|
import { CoveoAnalyticsClient } from "coveo.analytics";
|
|
20
|
-
import { SearchSyncer } from "docUtils/searchSyncer";
|
|
21
21
|
|
|
22
22
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
23
|
-
const handleContentError = (error
|
|
23
|
+
const handleContentError = (error): void => console.log(error);
|
|
24
24
|
|
|
25
25
|
const PIXEL_PER_CHARACTER_MAP: { [key: string]: number } = {
|
|
26
26
|
default: 7.7,
|
|
@@ -31,7 +31,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
31
31
|
isFetchingDocument: boolean;
|
|
32
32
|
isFetchingContent: boolean;
|
|
33
33
|
lastHighlightedSearch: string;
|
|
34
|
-
internalLinkClicked: boolean;
|
|
35
34
|
}> {
|
|
36
35
|
@api apiDomain = "https://developer.salesforce.com";
|
|
37
36
|
@api coveoOrganizationId!: string;
|
|
@@ -61,14 +60,14 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
61
60
|
|
|
62
61
|
private availableLanguages: Array<DocLanguage> = [];
|
|
63
62
|
private availableVersions: Array<DocVersion> = [];
|
|
64
|
-
private contentProvider
|
|
63
|
+
private contentProvider: FetchContent;
|
|
65
64
|
private docContent = "";
|
|
66
|
-
private language
|
|
65
|
+
private language: DocLanguage = null;
|
|
67
66
|
private loaded = false;
|
|
68
67
|
private pdfUrl = "";
|
|
69
68
|
private tocMap: TocMap = {};
|
|
70
|
-
private sidebarContent: Array<TreeNode>
|
|
71
|
-
private version: DocVersion
|
|
69
|
+
private sidebarContent: Array<TreeNode> = null;
|
|
70
|
+
private version: DocVersion = null;
|
|
72
71
|
private docTitle = "";
|
|
73
72
|
private _pathName = "";
|
|
74
73
|
private _pageHeader?: Header;
|
|
@@ -175,8 +174,8 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
175
174
|
renderedCallback(): void {
|
|
176
175
|
this.setState({ internalLinkClicked: true });
|
|
177
176
|
const urlSectionLink =
|
|
178
|
-
this.pageReference?.hash?.split("#").length
|
|
179
|
-
? this.pageReference.hash
|
|
177
|
+
this.pageReference?.hash?.split("#").length > 1
|
|
178
|
+
? this.pageReference.hash.split("#")[1]
|
|
180
179
|
: this.pageReference?.hash;
|
|
181
180
|
|
|
182
181
|
const contentEl = this.template.querySelector("doc-content");
|
|
@@ -224,15 +223,15 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
224
223
|
}
|
|
225
224
|
}
|
|
226
225
|
|
|
227
|
-
private get languageId(): string
|
|
228
|
-
return this.language
|
|
226
|
+
private get languageId(): string {
|
|
227
|
+
return this.language.id.replace("-", "_");
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
private get releaseVersionId(): string
|
|
232
|
-
return this.version
|
|
230
|
+
private get releaseVersionId(): string {
|
|
231
|
+
return this.version.id;
|
|
233
232
|
}
|
|
234
233
|
|
|
235
|
-
private get deliverable(): string
|
|
234
|
+
private get deliverable(): string {
|
|
236
235
|
return this.pageReference.deliverable;
|
|
237
236
|
}
|
|
238
237
|
|
|
@@ -253,11 +252,10 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
253
252
|
}
|
|
254
253
|
|
|
255
254
|
private get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
|
|
256
|
-
const config: { locale
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
};
|
|
255
|
+
const config: { locale: string; topicid: string; version?: string } = {
|
|
256
|
+
locale: this.languageId,
|
|
257
|
+
topicid: this.deliverable
|
|
258
|
+
};
|
|
261
259
|
|
|
262
260
|
if (this.releaseVersionId && this.releaseVersionId !== "noversion") {
|
|
263
261
|
config.version = this.releaseVersionId;
|
|
@@ -268,7 +266,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
268
266
|
|
|
269
267
|
private get pageHeader(): Header {
|
|
270
268
|
if (!this._pageHeader) {
|
|
271
|
-
this._pageHeader = document.querySelector("doc-header")
|
|
269
|
+
this._pageHeader = document.querySelector("doc-header");
|
|
272
270
|
}
|
|
273
271
|
|
|
274
272
|
return this._pageHeader;
|
|
@@ -311,7 +309,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
311
309
|
|
|
312
310
|
private get breadcrumbPixelPerCharacter() {
|
|
313
311
|
return (
|
|
314
|
-
PIXEL_PER_CHARACTER_MAP[this.language
|
|
312
|
+
PIXEL_PER_CHARACTER_MAP[this.language.id] ||
|
|
315
313
|
PIXEL_PER_CHARACTER_MAP.default
|
|
316
314
|
);
|
|
317
315
|
}
|
|
@@ -360,7 +358,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
360
358
|
this.updateUrl();
|
|
361
359
|
}
|
|
362
360
|
|
|
363
|
-
handleLanguageChange = (event:
|
|
361
|
+
handleLanguageChange = (event: CustomEvent<string>): Promise<void> => {
|
|
364
362
|
if (this.language && this.language.id === event.detail) {
|
|
365
363
|
return;
|
|
366
364
|
}
|
|
@@ -368,7 +366,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
368
366
|
this.language = this.availableLanguages.find(
|
|
369
367
|
({ id }) => id === event.detail
|
|
370
368
|
);
|
|
371
|
-
this.pageReference.docId = this.language
|
|
369
|
+
this.pageReference.docId = this.language.url;
|
|
372
370
|
|
|
373
371
|
trackGTM(event.target!, "custEv_ctaLinkClick", {
|
|
374
372
|
click_text: event.detail,
|
|
@@ -455,8 +453,8 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
455
453
|
this.setState({
|
|
456
454
|
isFetchingDocument: true
|
|
457
455
|
});
|
|
458
|
-
const data = await this.contentProvider
|
|
459
|
-
this.pageReference.docId
|
|
456
|
+
const data = await this.contentProvider.fetchDocumentData(
|
|
457
|
+
this.pageReference.docId
|
|
460
458
|
);
|
|
461
459
|
|
|
462
460
|
// This could be a 404 scenario.
|
|
@@ -519,12 +517,12 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
519
517
|
this.setState({
|
|
520
518
|
isFetchingContent: true
|
|
521
519
|
});
|
|
522
|
-
const data = await this.contentProvider
|
|
523
|
-
this.pageReference.deliverable
|
|
524
|
-
this.pageReference.contentDocumentId
|
|
520
|
+
const data = await this.contentProvider.fetchContent(
|
|
521
|
+
this.pageReference.deliverable,
|
|
522
|
+
this.pageReference.contentDocumentId,
|
|
525
523
|
{
|
|
526
|
-
language: this.language
|
|
527
|
-
version: this.version
|
|
524
|
+
language: this.language.id,
|
|
525
|
+
version: this.version.id
|
|
528
526
|
}
|
|
529
527
|
);
|
|
530
528
|
|
|
@@ -588,26 +586,23 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
588
586
|
}
|
|
589
587
|
|
|
590
588
|
private updateSearchInput(searchParam: string): void {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
589
|
+
this.template
|
|
590
|
+
.querySelector("doc-content-layout")
|
|
591
|
+
?.setSidebarInputValue(searchParam);
|
|
594
592
|
}
|
|
595
593
|
|
|
596
594
|
private pageReferenceToString(reference: PageReference): string {
|
|
597
595
|
const { page, docId, deliverable, contentDocumentId, hash, search } =
|
|
598
596
|
reference;
|
|
599
597
|
return `/${page}/${docId}/${deliverable}/${contentDocumentId}${this.normalizeSearch(
|
|
600
|
-
search
|
|
598
|
+
search
|
|
601
599
|
)}${this.normalizeHash(hash)}`;
|
|
602
600
|
}
|
|
603
601
|
|
|
604
|
-
private normalizeUrlPart(
|
|
605
|
-
part: string | undefined,
|
|
606
|
-
sentinel: string
|
|
607
|
-
): string {
|
|
602
|
+
private normalizeUrlPart(part: string, sentinel: string): string {
|
|
608
603
|
return (
|
|
609
604
|
(part &&
|
|
610
|
-
(part.startsWith(sentinel
|
|
605
|
+
(part.startsWith(sentinel) ? part : `${sentinel}${part}`)) ||
|
|
611
606
|
""
|
|
612
607
|
);
|
|
613
608
|
}
|
|
@@ -616,16 +611,16 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
616
611
|
return this.normalizeUrlPart(search, "?");
|
|
617
612
|
}
|
|
618
613
|
|
|
619
|
-
private normalizeHash(hash
|
|
614
|
+
private normalizeHash(hash: string): string {
|
|
620
615
|
return this.normalizeUrlPart(hash, "#");
|
|
621
616
|
}
|
|
622
617
|
|
|
623
618
|
private getComposedTitle(
|
|
624
|
-
topicTitle: string |
|
|
619
|
+
topicTitle: string | undefined,
|
|
625
620
|
docTitle: string | undefined
|
|
626
621
|
): string {
|
|
627
622
|
// map to avoid duplicates
|
|
628
|
-
const titleMap
|
|
623
|
+
const titleMap = {};
|
|
629
624
|
if (topicTitle) {
|
|
630
625
|
// sometimes the h1 tag text (which is docSubTitle) contains text with new line character. For e.g, "Bulk API 2.0 Older\n Documentation",
|
|
631
626
|
// here it contains \n in the text context which needs to be removed
|
|
@@ -762,7 +757,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
762
757
|
const headTag = document.getElementsByTagName("head");
|
|
763
758
|
// this checks if the selected version is not the latest version,
|
|
764
759
|
// then it adds the noindex, follow meta tag to the older version pages.
|
|
765
|
-
const versionId = this.version
|
|
760
|
+
const versionId = this.version.id;
|
|
766
761
|
const docId = this.pageReference.docId;
|
|
767
762
|
|
|
768
763
|
// SEO fix:
|
|
@@ -3,61 +3,57 @@ img.content-image {
|
|
|
3
3
|
display: unset;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
6
|
+
.image-framed {
|
|
7
7
|
border: 1px solid black;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.content-image.image-xxl,
|
|
15
|
-
.content-image.image-full {
|
|
10
|
+
.image-xxl,
|
|
11
|
+
.image-full {
|
|
16
12
|
max-width: 1000px;
|
|
17
13
|
width: 100%;
|
|
18
14
|
}
|
|
19
15
|
|
|
20
|
-
.
|
|
16
|
+
.image-xl {
|
|
21
17
|
max-width: 750px;
|
|
22
18
|
width: 100%;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
.
|
|
21
|
+
.image-lg {
|
|
26
22
|
max-width: 660px;
|
|
27
23
|
width: 100%;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
.
|
|
26
|
+
.image-md {
|
|
31
27
|
max-width: 500px;
|
|
32
28
|
width: 100%;
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
.
|
|
31
|
+
.image-sm {
|
|
36
32
|
max-width: 330px;
|
|
37
33
|
width: 100%;
|
|
38
34
|
}
|
|
39
35
|
|
|
40
|
-
.
|
|
36
|
+
.image-xs {
|
|
41
37
|
max-width: 250px;
|
|
42
38
|
width: 100%;
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
.
|
|
41
|
+
.image-xxs {
|
|
46
42
|
max-width: 125px;
|
|
47
43
|
width: 100%;
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
.
|
|
46
|
+
.image-icon-lg {
|
|
51
47
|
max-width: 32px;
|
|
52
48
|
width: 100%;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
.
|
|
51
|
+
.image-icon-md {
|
|
56
52
|
max-width: 20px;
|
|
57
53
|
width: 100%;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
.
|
|
56
|
+
.image-icon-sm {
|
|
61
57
|
max-width: 16px;
|
|
62
58
|
width: 100%;
|
|
63
59
|
}
|