feature: youtube embeds
fix: little more padding
This commit is contained in:
parent
f20aecb90b
commit
5f4f1eecc5
2 changed files with 17 additions and 0 deletions
|
@ -61,6 +61,7 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 5rem;
|
bottom: 5rem;
|
||||||
|
padding: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#talk #room-chat-entry-container {
|
#talk #room-chat-entry-container {
|
||||||
|
|
|
@ -7,6 +7,22 @@ const URL_MATCH_HANDLERS = [
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
(match) => {
|
||||||
|
const original_url = match[0];
|
||||||
|
const {
|
||||||
|
groups: { video_id },
|
||||||
|
} =
|
||||||
|
/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)(?<video_id>[^"&?\/\s]{11})/gi.exec(
|
||||||
|
original_url,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!video_id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `<iframe width="560" height="315" src="https://www.youtube.com/embed/${video_id}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>`;
|
||||||
|
},
|
||||||
|
|
||||||
// url
|
// url
|
||||||
(match) => {
|
(match) => {
|
||||||
// TODO: punycoding if something has unicode?
|
// TODO: punycoding if something has unicode?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue