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:
Régis Hanol 2024-12-04 11:56:28 +01:00 committed by GitHub
parent 3e7f0867ea
commit f294f984cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}