mirror of
https://github.com/discourse/discourse.git
synced 2024-12-20 15:03:56 +08:00
FIX: properly quote videos (#30099)
Follow up to f294f984cf
All that was needed was a little fix to our markdown engine to use the
"image src" as the "video src" when the "data video src" was not
defined.
That way we can use the regular image markdown with the "|video" option
(?).
This commit is contained in:
parent
1ce12ae718
commit
d2d8fbcf3b
|
@ -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];
|
||||
|
|
|
@ -169,9 +169,7 @@ export function selectedText() {
|
|||
div
|
||||
.querySelectorAll("div.video-placeholder-container[data-video-src]")
|
||||
.forEach((element) => {
|
||||
element.replaceWith(
|
||||
`<div class="video-container"><video preload="metadata" controls><source src="${element.dataset.videoSrc}"></video></div>`
|
||||
);
|
||||
element.replaceWith(`![|video](${element.dataset.videoSrc})`);
|
||||
});
|
||||
|
||||
return toMarkdown(div.outerHTML);
|
||||
|
|
Loading…
Reference in New Issue
Block a user