瀏覽代碼

feat: Web <video> and <audio> element support src attribute (#19988)

tags/1.4.1
ruanjiefeng 5 月之前
父節點
當前提交
9ebc58b1a2
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 10 行新增2 行删除
  1. 10
    2
      web/app/components/base/markdown.tsx

+ 10
- 2
web/app/components/base/markdown.tsx 查看文件

@@ -216,16 +216,24 @@ CodeBlock.displayName = 'CodeBlock'

const VideoBlock: any = memo(({ node }: any) => {
const srcs = node.children.filter((child: any) => 'properties' in child).map((child: any) => (child as any).properties.src)
if (srcs.length === 0)
if (srcs.length === 0) {
const src = node.properties?.src
if (src)
return <VideoGallery key={src} srcs={[src]} />
return null
}
return <VideoGallery key={srcs.join()} srcs={srcs} />
})
VideoBlock.displayName = 'VideoBlock'

const AudioBlock: any = memo(({ node }: any) => {
const srcs = node.children.filter((child: any) => 'properties' in child).map((child: any) => (child as any).properties.src)
if (srcs.length === 0)
if (srcs.length === 0) {
const src = node.properties?.src
if (src)
return <AudioGallery key={src} srcs={[src]} />
return null
}
return <AudioGallery key={srcs.join()} srcs={srcs} />
})
AudioBlock.displayName = 'AudioBlock'

Loading…
取消
儲存