diff --git a/app/assets/javascripts/discourse-markdown-it/src/engine.js b/app/assets/javascripts/discourse-markdown-it/src/engine.js index 8e5deb7bdf0..21a1ddf4d97 100644 --- a/app/assets/javascripts/discourse-markdown-it/src/engine.js +++ b/app/assets/javascripts/discourse-markdown-it/src/engine.js @@ -187,7 +187,7 @@ function renderImageOrPlayableMedia(tokens, idx, options, env, slf) { options.discourse.previewing && !options.discourse.limitedSiteSettings.enableDiffhtmlPreview ) { - const origSrc = token.attrGet("data-orig-src"); + const origSrc = token.attrGet("data-orig-src") || token.attrGet("src"); const origSrcId = origSrc .substring(origSrc.lastIndexOf("/") + 1) .split(".")[0]; diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.js index 6c9a9a3c366..57ad015b19c 100644 --- a/app/assets/javascripts/discourse/app/lib/utilities.js +++ b/app/assets/javascripts/discourse/app/lib/utilities.js @@ -169,9 +169,7 @@ export function selectedText() { div .querySelectorAll("div.video-placeholder-container[data-video-src]") .forEach((element) => { - element.replaceWith( - `
` - ); + element.replaceWith(`![|video](${element.dataset.videoSrc})`); }); return toMarkdown(div.outerHTML);