diff --git a/blocks/edit/da-content/da-content.js b/blocks/edit/da-content/da-content.js
index 142b279b2..c59ccf7a6 100644
--- a/blocks/edit/da-content/da-content.js
+++ b/blocks/edit/da-content/da-content.js
@@ -12,7 +12,6 @@ export default class DaContent extends LitElement {
permissions: { attribute: false },
proseEl: { attribute: false },
wsProvider: { attribute: false },
- lockdownImages: { attribute: false },
_editorLoaded: { state: true },
_showPane: { state: true },
_versionUrl: { state: true },
@@ -75,11 +74,6 @@ export default class DaContent extends LitElement {
const { owner, repo, previewUrl } = this.details;
const { pathname } = new URL(previewUrl);
- // Only use livePreviewUrl if lockdownImages flag is set to true
- const displayUrl = this.lockdownImages
- ? `${getLivePreviewUrl(owner, repo)}${pathname}`
- : previewUrl;
-
return html`
${this._editorLoaded ? html`
.metadata');
// Check if the metadata div has no additional classes (or doesn't exist)
diff --git a/blocks/shared/prose2aem.js b/blocks/shared/prose2aem.js
index 5afbb3825..c769d958a 100644
--- a/blocks/shared/prose2aem.js
+++ b/blocks/shared/prose2aem.js
@@ -59,7 +59,7 @@ function convertBlocks(editor, isFragment = false) {
});
}
-function makePictures(editor, live, lockdown) {
+function makePictures(editor, live) {
const imgs = editor.querySelectorAll('img');
imgs.forEach((img) => {
img.removeAttribute('contenteditable');
@@ -82,20 +82,22 @@ function makePictures(editor, live, lockdown) {
if (daCursor) setCursor(daCursor, img);
const clone = img.cloneNode(true);
- if (live && lockdown) {
- // make images relative to the live preview URL
- const source = new URL(clone.src);
- if (source.host.endsWith('.da.live')) {
- source.pathname = `/${source.pathname
- .split('/')
- .slice(3) // remove org and site
- .join('/')}`;
- clone.src = source.toString();
- }
- }
-
clone.setAttribute('loading', 'lazy');
+ if (live && clone.src) {
+ try {
+ const source = new URL(clone.src);
+ if (source.host.endsWith('.da.live')) {
+ source.pathname = `/${source.pathname
+ .split('/')
+ .slice(3) // remove org and site
+ .join('/')}`;
+ clone.src = source.toString();
+ }
+ } catch {
+ // src is not an absolute URL, nothing to rewrite
+ }
+ }
let pic = document.createElement('picture');
const srcMobile = document.createElement('source');
@@ -206,10 +208,9 @@ const removeEls = (els) => els.forEach((el) => el.remove());
* @param {HTMLElement} editor the editor dom
* @param {Boolean} livePreview whether or not the target destination is Live Preview
* @param {Boolean} isFragment whether or not the DOM is a fragment
- * @param {Boolean} lockdownImages whether or not to make images and content.da.live URLs relative
* @returns AEM-friendly HTML as a text string
*/
-export default function prose2aem(editor, livePreview, isFragment = false, lockdownImages = false) {
+export default function prose2aem(editor, livePreview, isFragment = false) {
if (!isFragment) editor.removeAttribute('class');
editor.removeAttribute('contenteditable');
@@ -246,7 +247,7 @@ export default function prose2aem(editor, livePreview, isFragment = false, lockd
parseIcons(editor);
}
- makePictures(editor, livePreview, lockdownImages);
+ makePictures(editor, livePreview);
if (!isFragment) {
makeSections(editor);
@@ -264,7 +265,7 @@ export default function prose2aem(editor, livePreview, isFragment = false, lockd