mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 04:10:22 +08:00
FIX: unable to quote video (#30077)
This replaces the video container / thumbnail with a proper "<video>" element when quoting a video. It's not the best UX, especially when "morphing" is disabled. Needs more work. Internal ref - t/143321
This commit is contained in:
parent
3e7f0867ea
commit
f294f984cf
@ -156,18 +156,24 @@ export function selectedText() {
|
||||
} else if (oneboxTest) {
|
||||
// This is a partial quote from a onebox.
|
||||
// Treat it as though the entire onebox was quoted.
|
||||
const oneboxUrl = oneboxTest.dataset.oneboxSrc;
|
||||
div.append(oneboxUrl);
|
||||
div.append(oneboxTest.dataset.oneboxSrc);
|
||||
} else {
|
||||
div.append(range.cloneContents());
|
||||
}
|
||||
}
|
||||
|
||||
div.querySelectorAll("aside.onebox[data-onebox-src]").forEach((element) => {
|
||||
const oneboxUrl = element.dataset.oneboxSrc;
|
||||
element.replaceWith(oneboxUrl);
|
||||
element.replaceWith(element.dataset.oneboxSrc);
|
||||
});
|
||||
|
||||
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>`
|
||||
);
|
||||
});
|
||||
|
||||
return toMarkdown(div.outerHTML);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user