fix: support m.youtube.com subdomain links #27

Merged
verbiricha merged 3 commits from youtube-m into main 2023-01-10 16:39:48 +00:00
3 changed files with 8 additions and 4 deletions

View File

@ -61,4 +61,4 @@ export const InvoiceRegex = /(lnbc\w+)/i;
/** /**
* YouTube URL regex * YouTube URL regex
*/ */
export const YoutubeUrlRegex = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/ export const YoutubeUrlRegex = /^(?:https?:\/\/)?(?:www|m\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/

View File

@ -35,6 +35,7 @@ function transformHttpLink(a) {
<> <>
<br /> <br />
<iframe <iframe
className="w-max"
src={`https://www.youtube.com/embed/${youtubeId}`} src={`https://www.youtube.com/embed/${youtubeId}`}
title="YouTube video player" title="YouTube video player"
frameBorder="0" frameBorder="0"

View File

@ -32,12 +32,15 @@
.note > .body img, .note > .body video, .note > .body iframe { .note > .body img, .note > .body video, .note > .body iframe {
max-width: 100%; max-width: 100%;
max-height: 500px; max-height: 500px;
margin: 10px; margin: 10px auto;
margin-left: auto;
margin-right: auto;
display: block; display: block;
} }
.note > .body iframe, note > .body video {
width: -webkit-fill-available;
aspect-ratio: 16 / 9;
}
v0l commented 2023-01-10 15:55:01 +00:00 (Migrated from github.com)
Review

It might be better to add w-max class to the iframe since this doesnt work on any non-webkit browsers

It might be better to add `w-max` class to the iframe since this doesnt work on any non-webkit browsers
verbiricha commented 2023-01-10 16:24:29 +00:00 (Migrated from github.com)
Review

Added in 236da05

Added in [236da05](https://github.com/v0l/snort/pull/27/commits/236da0561770a9ad9679f9ec2657e6c73b247221)
.note > .header img:hover, .note > .header .name > .reply:hover, .note .body:hover { .note > .header img:hover, .note > .header .name > .reply:hover, .note .body:hover {
cursor: pointer; cursor: pointer;
} }