@salesforcedevs/docs-components
Advanced tools
Comparing version
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.14.3-alpha", | ||
"version": "1.14.4-edit", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -16,2 +16,3 @@ "license": "MIT", | ||
"classnames": "2.5.1", | ||
"dompurify": "3.2.4", | ||
"kagekiri": "1.4.2", | ||
@@ -18,0 +19,0 @@ "lodash.orderby": "4.6.0", |
@@ -21,2 +21,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
import { track as trackGTM } from "dxUtils/analytics"; | ||
import DOMPurify from "dompurify"; | ||
@@ -429,5 +430,15 @@ // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later. | ||
private sanitizeUrlPart(part: string | undefined): string | undefined { | ||
if (!part) { | ||
return part; | ||
} | ||
return DOMPurify.sanitize(part); | ||
} | ||
getReferenceFromUrl(): PageReference { | ||
const [page, docId, deliverable, contentDocumentId] = | ||
window.location.pathname.substr(1).split("/"); | ||
window.location.pathname | ||
.substr(1) | ||
.split("/") | ||
.map(this.sanitizeUrlPart); | ||
@@ -441,5 +452,5 @@ const { origin: domain, hash, search } = window.location; | ||
domain, | ||
hash, | ||
hash: this.sanitizeUrlPart(hash), | ||
page, | ||
search | ||
search: this.sanitizeUrlPart(search) | ||
}; | ||
@@ -707,3 +718,3 @@ } | ||
const div = document.createElement("div"); | ||
div.innerHTML = this.docContent; | ||
div.innerHTML = DOMPurify.sanitize(this.docContent); | ||
const docDescription = div.querySelector(".shortdesc")?.textContent; | ||
@@ -710,0 +721,0 @@ const topicTitle = div.querySelector("h1")?.textContent; |
289604
3.86%94
4.44%7198
3.55%8
14.29%+ Added
+ Added
+ Added