支持嵌入视频
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
<link rel="icon" href="%PUBLIC_URL%/static/favicon/512.png">
|
<link rel="icon" href="%PUBLIC_URL%/static/favicon/512.png">
|
||||||
<meta name="format-detection" content="telephone=no">
|
<meta name="format-detection" content="telephone=no">
|
||||||
|
|
||||||
|
<meta name="referrer" content="no-referrer">
|
||||||
|
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<link rel="shortcut icon" href="%PUBLIC_URL%/static/favicon/512.png">
|
<link rel="shortcut icon" href="%PUBLIC_URL%/static/favicon/512.png">
|
||||||
<link rel="manifest" href="./static/manifest.json">
|
<link rel="manifest" href="./static/manifest.json">
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
margin-left: .15rem;
|
margin-left: .15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ext-img {
|
.ext-img, .ext-video {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 2000px;
|
max-height: 2000px;
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ function escape_regex(string) {
|
|||||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_video(s) {
|
||||||
|
try {
|
||||||
|
let url = new URL(s);
|
||||||
|
return url.pathname.endsWith('.mp4') || url.pathname.endsWith('.mov');
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function build_highlight_re(
|
export function build_highlight_re(
|
||||||
txt,
|
txt,
|
||||||
split = ' ',
|
split = ' ',
|
||||||
@@ -150,6 +159,7 @@ export class HighlightedMarkdown extends Component {
|
|||||||
/##
|
/##
|
||||||
</span>
|
</span>
|
||||||
) : rule === 'url' ? (
|
) : rule === 'url' ? (
|
||||||
|
<>
|
||||||
<a
|
<a
|
||||||
href={normalize_url(p)}
|
href={normalize_url(p)}
|
||||||
className="ext-link"
|
className="ext-link"
|
||||||
@@ -159,6 +169,10 @@ export class HighlightedMarkdown extends Component {
|
|||||||
{p}
|
{p}
|
||||||
<span className="icon icon-new-tab" />
|
<span className="icon icon-new-tab" />
|
||||||
</a>
|
</a>
|
||||||
|
{is_video(p) && (
|
||||||
|
<video className="ext-video" src={p} controls loop/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
) : rule === 'pid' ? (
|
) : rule === 'pid' ? (
|
||||||
<a
|
<a
|
||||||
href={'#' + p}
|
href={'#' + p}
|
||||||
|
|||||||
Reference in New Issue
Block a user