@salesforcedevs/docs-components 1.17.2 → 1.17.5-alpha2
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 +2 -2
- package/src/modules/doc/componentPlayground/componentPlayground.css +1 -1
- package/src/modules/doc/componentPlayground/componentPlayground.html +2 -2
- package/src/modules/doc/componentPlayground/componentPlayground.ts +13 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +15 -9
- package/LICENSE +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.5-alpha2",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
29
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="container" lwc:if={playgroundAvailable}>
|
|
2
|
+
<div class="playground-container" lwc:if={playgroundAvailable}>
|
|
3
3
|
<dx-spinner
|
|
4
4
|
size="large"
|
|
5
5
|
variant="brand"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<iframe
|
|
9
9
|
src={playgroundSrc}
|
|
10
10
|
onload={handleIframeLoad}
|
|
11
|
-
title=
|
|
11
|
+
title={playgroundTitle}
|
|
12
12
|
allow="clipboard-write"
|
|
13
13
|
></iframe>
|
|
14
14
|
</div>
|
|
@@ -8,6 +8,19 @@ export default class ComponentPlayground extends LightningElement {
|
|
|
8
8
|
|
|
9
9
|
isLoading = true;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Returns a formatted title for the component playground
|
|
13
|
+
* Maps 'aura' model to 'Aura' and 'lwc' model to 'Lightning'
|
|
14
|
+
* Capitalizes the first letter of the component name
|
|
15
|
+
* @returns {string} Formatted playground title
|
|
16
|
+
*/
|
|
17
|
+
get playgroundTitle() {
|
|
18
|
+
const modelName = this.model === "aura" ? "Aura" : "Lightning";
|
|
19
|
+
const componentName =
|
|
20
|
+
this.component.charAt(0).toUpperCase() + this.component.slice(1);
|
|
21
|
+
return `Example previews and code for ${modelName} ${componentName} component`;
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
get playgroundAvailable() {
|
|
12
25
|
return (
|
|
13
26
|
this.playgroundAppUrl &&
|
|
@@ -237,6 +237,8 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
237
237
|
this.updateSearchInput(nextSearchParam);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
|
|
241
|
+
this.addMetatags();
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
disconnectedCallback(): void {
|
|
@@ -531,7 +533,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
531
533
|
}
|
|
532
534
|
|
|
533
535
|
this.docContent = data.content;
|
|
534
|
-
this.addMetatags();
|
|
535
536
|
this.setState({
|
|
536
537
|
isFetchingDocument: false
|
|
537
538
|
});
|
|
@@ -553,7 +554,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
553
554
|
|
|
554
555
|
if (data) {
|
|
555
556
|
this.docContent = data.content;
|
|
556
|
-
this.addMetatags();
|
|
557
557
|
|
|
558
558
|
if (!this.pageReference.hash) {
|
|
559
559
|
document.body.scrollIntoView();
|
|
@@ -721,6 +721,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
addMetatags(): void {
|
|
724
|
+
if (!this.docContent) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
724
727
|
const div = document.createElement("div");
|
|
725
728
|
div.innerHTML = DOMPurify.sanitize(this.docContent);
|
|
726
729
|
const docDescription = div.querySelector(".shortdesc")?.textContent;
|
|
@@ -784,15 +787,18 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
784
787
|
// Doc id without version id is always considered latest and should be used for SEO.
|
|
785
788
|
// Condition is to find a docId which includes version id,
|
|
786
789
|
// these docs are always considered as old and should not be indexed including the preview docs.
|
|
790
|
+
const metaTag = document.querySelector('meta[name="robots"]');
|
|
787
791
|
if (
|
|
788
792
|
headTag.length &&
|
|
789
|
-
docId?.includes(versionId)
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
793
|
+
docId?.includes(versionId)) {
|
|
794
|
+
if (!metaTag) {
|
|
795
|
+
const robotsMeta = document.createElement("meta");
|
|
796
|
+
robotsMeta.setAttribute("name", "robots");
|
|
797
|
+
robotsMeta.setAttribute("content", "noindex, follow");
|
|
798
|
+
headTag[0].appendChild(robotsMeta);
|
|
799
|
+
}
|
|
800
|
+
} else if(metaTag && metaTag.parentNode) { // if metatag exists and if it is attached to a parent, then remove it.
|
|
801
|
+
metaTag.remove();
|
|
796
802
|
}
|
|
797
803
|
}
|
|
798
804
|
|
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.
|