@salesforcedevs/docs-components 0.68.2 → 0.69.1-miles
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": "0.
|
|
3
|
+
"version": "0.69.1-miles",
|
|
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": "
|
|
27
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
28
28
|
}
|
|
@@ -38,7 +38,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
38
38
|
return this._breadcrumbs;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
set breadcrumbs(value) {
|
|
41
|
+
set breadcrumbs(value): [] {
|
|
42
42
|
if (value) {
|
|
43
43
|
this._breadcrumbs = toJson(value);
|
|
44
44
|
}
|
|
@@ -78,6 +78,8 @@ export default class ContentLayout extends LightningElement {
|
|
|
78
78
|
private anchoredElements: AnchorMap = {};
|
|
79
79
|
private lastScrollPosition: number;
|
|
80
80
|
private observer?: IntersectionObserver;
|
|
81
|
+
private hasRendered: boolean = false;
|
|
82
|
+
|
|
81
83
|
private searchSyncer = new SearchSyncer({
|
|
82
84
|
callbacks: {
|
|
83
85
|
onUrlChange: (nextSearchString: string): void => {
|
|
@@ -109,6 +111,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
109
111
|
return window.location.pathname;
|
|
110
112
|
}
|
|
111
113
|
|
|
114
|
+
get showBreadcrumbs(): boolean {
|
|
115
|
+
return this.breadcrumbs != null && (this.breadcrumbs as any[]).length > 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
112
118
|
connectedCallback(): void {
|
|
113
119
|
const hasParentHighlightListener = closest(
|
|
114
120
|
"doc-xml-content",
|
|
@@ -125,6 +131,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
125
131
|
this._scrollInterval = window.setInterval(() => {
|
|
126
132
|
this.saveScroll();
|
|
127
133
|
}, 1000);
|
|
134
|
+
|
|
128
135
|
|
|
129
136
|
}
|
|
130
137
|
|
|
@@ -138,7 +145,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
138
145
|
this.attachInteractionObserver,
|
|
139
146
|
OBSERVER_ATTACH_WAIT_TIME
|
|
140
147
|
);
|
|
141
|
-
this.
|
|
148
|
+
if(!this.hasRendered) {
|
|
149
|
+
this.hasRendered = true;
|
|
150
|
+
this.restoreScroll();
|
|
151
|
+
}
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
disconnectedCallback(): void {
|
|
@@ -18,11 +18,6 @@ import { Breadcrumb, Language } from "typings/custom";
|
|
|
18
18
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
19
19
|
const handleContentError = (error): void => console.log(error);
|
|
20
20
|
|
|
21
|
-
const FIRST_CRUMB = {
|
|
22
|
-
href: "/docs",
|
|
23
|
-
label: "Documentation"
|
|
24
|
-
};
|
|
25
|
-
|
|
26
21
|
const PIXEL_PER_CHARACTER_MAP: { [key: string]: number } = {
|
|
27
22
|
default: 7.7,
|
|
28
23
|
"ja-jp": 12.5
|
|
@@ -581,6 +576,10 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
581
576
|
);
|
|
582
577
|
}
|
|
583
578
|
|
|
579
|
+
get showBreadcrumbs(): boolean {
|
|
580
|
+
return this.breadcrumbs && this.breadcrumbs.length > 0;
|
|
581
|
+
}
|
|
582
|
+
|
|
584
583
|
private buildBreadcrumbs(): void {
|
|
585
584
|
const { contentDocumentId } = this.pageReference;
|
|
586
585
|
if (!contentDocumentId) {
|
|
@@ -588,23 +587,31 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
588
587
|
}
|
|
589
588
|
|
|
590
589
|
const currentNode = this.tocMap[contentDocumentId];
|
|
591
|
-
|
|
590
|
+
|
|
591
|
+
if(currentNode.parent) {
|
|
592
|
+
this.breadcrumbs = this.nodeToBreadcrumb(currentNode);
|
|
593
|
+
} else {
|
|
594
|
+
this.breadcrumbs = [];
|
|
595
|
+
}
|
|
592
596
|
}
|
|
593
597
|
|
|
594
|
-
private nodeToBreadcrumb(node
|
|
595
|
-
|
|
596
|
-
|
|
598
|
+
private nodeToBreadcrumb(node: TreeNode): Breadcrumb[] {
|
|
599
|
+
const item = {
|
|
600
|
+
href: this.pageReferenceToString({
|
|
601
|
+
...this.pageReference,
|
|
602
|
+
contentDocumentId: node.name
|
|
603
|
+
}),
|
|
604
|
+
label: node.label
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
if(node.parent) {
|
|
608
|
+
return [
|
|
609
|
+
...this.nodeToBreadcrumb(node.parent),
|
|
610
|
+
item
|
|
611
|
+
];
|
|
597
612
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
{
|
|
601
|
-
href: this.pageReferenceToString({
|
|
602
|
-
...this.pageReference,
|
|
603
|
-
contentDocumentId: node.name
|
|
604
|
-
}),
|
|
605
|
-
label: node.label
|
|
606
|
-
}
|
|
607
|
-
];
|
|
613
|
+
|
|
614
|
+
return [item];
|
|
608
615
|
}
|
|
609
616
|
|
|
610
617
|
addMetatags(): void {
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
-
|
|
10
|
-
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
-
|
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|