@salesforcedevs/docs-components
Advanced tools
Comparing version 0.2.44 to 0.2.48
@@ -10,4 +10,4 @@ { | ||
"doc/contentMedia", | ||
"doc/codeBlock" | ||
"doc/content" | ||
] | ||
} |
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "0.2.44", | ||
"version": "0.2.48", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "b0fa4d66e02006c100768ee9a9e3c1970bc49c77" | ||
"gitHead": "6e155321bbf9ff7b93278622c4ec2021ebe9679c" | ||
} |
@@ -187,5 +187,6 @@ /* eslint-disable @lwc/lwc/no-inner-html */ | ||
const imgEls = templateEl.content.querySelectorAll("img, iframe"); | ||
imgEls.forEach((mediaEl) => { | ||
const isImage = mediaEl.nodeName === "IMG"; | ||
const src = mediaEl.getAttribute("src"); | ||
let src = mediaEl.getAttribute("src"); | ||
if (!src) { | ||
@@ -197,8 +198,12 @@ return; | ||
const label = mediaEl.getAttribute("label"); | ||
const updatedSrc = isImage | ||
? src.replace( | ||
window.location.origin, | ||
"https://developer.salesforce.com" | ||
) | ||
: src; | ||
if (isImage) { | ||
src = src.startsWith("/") | ||
? `https://developer.salesforce.com${src}` | ||
: src.replace( | ||
window.location.origin, | ||
"https://developer.salesforce.com" | ||
); | ||
} | ||
const contentMediaEl = createElement("doc-content-media", { | ||
@@ -209,3 +214,3 @@ is: ContentMedia | ||
contentType: isImage ? "image" : "iframe", | ||
contentSrc: updatedSrc, | ||
contentSrc: src, | ||
mediaTitle: alt || title || label | ||
@@ -212,0 +217,0 @@ }); |
404743
7841