FIX: Wrap markdown videos with video-container class to stop post height jumping (#8806)

This will lock video aspect ratio to 16:9 and stop them from making posts jump around on load.

See also discourse/onebox@6f58545 and fe20cb4.
This commit is contained in:
Martin Brennan
2020-01-29 15:52:02 +10:00
committed by GitHub
parent d2ce733936
commit 397adfd128
4 changed files with 16 additions and 9 deletions

View File

@ -976,10 +976,12 @@ QUnit.test("images", assert => {
QUnit.test("video", assert => {
assert.cooked(
"![baby shark|video](upload://eyPnj7UzkU0AkGkx2dx8G4YM1Jx.mp4)",
`<p><video width="100%" height="100%" controls>
<source src="/404" data-orig-src="upload://eyPnj7UzkU0AkGkx2dx8G4YM1Jx.mp4">
<a href="/404">/404</a>
</video></p>`,
`<p><div class="video-container">
<video width="100%" height="100%" controls>
<source src="/404" data-orig-src="upload://eyPnj7UzkU0AkGkx2dx8G4YM1Jx.mp4">
<a href="/404">/404</a>
</video>
</div></p>`,
"It returns the correct video player HTML"
);
});