From 6c37d04591d0fdfef130425346f69bd5d7ce3843 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Tue, 24 Sep 2024 18:45:20 +0800 Subject: [PATCH 1/2] auto play video/audio --- app/components/markdown.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index 4f1b0ed24..d6765f263 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -279,6 +279,20 @@ function _MarkDownContent(props: { content: string }) { p: (pProps) =>

, a: (aProps) => { const href = aProps.href || ""; + if (/\.(aac|mp3|opus|wav)$/.test(href)) { + return ( +

+ +
+ ); + } + if (/\.(3gp|3g2|webm|ogv|mpeg|mp4|avi)$/.test(href)) { + return ( + + ); + } const isInternal = /^\/#/i.test(href); const target = isInternal ? "_self" : aProps.target ?? "_blank"; return ; From dbabb2c4030a96bb01aee5da35decef6f3328d6b Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Tue, 24 Sep 2024 18:48:55 +0800 Subject: [PATCH 2/2] auto play video/audio --- app/components/markdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index d6765f263..6c73d9ade 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -288,7 +288,7 @@ function _MarkDownContent(props: { content: string }) { } if (/\.(3gp|3g2|webm|ogv|mpeg|mp4|avi)$/.test(href)) { return ( -