File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,18 @@ Fügt ein lokales Video ein.
3636: Breite des Videos.
3737: Standardmässig auf die natürliche Breite des Videos gesetzt (wobei ` max-width=100% ` gesetzt wird).
3838: z.B. ` width=200px `
39+ ` controls `
40+ : Blendet die Steuerelemente des Videos ein oder aus.
41+ : Standardmässig ` true ` .
42+ : z.B. ` controls=false `
3943css Eigenschaften
4044: Es können beliebige css-Eigenschaften in Form ` eigenschaft=wert ` angegeben werden, die auf das Video angewendet werden.
4145
4246
4347``` mdx
44- ::video[ ./assets/yogi-bear.mp4] { width = 300px height = 200px muted autoplay loop border = " 2px solid red" }
48+ ::video[ ./assets/yogi-bear.mp4] { width = 300px height = 200px muted autoplay loop border = " 2px solid red" controls = false }
4549```
4650
4751<BrowserWindow >
48- ::video[ ./assets/yogi-bear.mp4] { width = 300px height = 200px muted autoplay loop border = " 2px solid red" }
52+ ::video[ ./assets/yogi-bear.mp4] { width = 300px height = 200px muted autoplay loop border = " 2px solid red" controls = false }
4953</BrowserWindow >
Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ const plugin: Plugin<unknown[], Root> = function plugin(): Transformer<Root> {
5252 newNode . attributes . push ( toJsxAttribute ( 'loop' , attributes . loop ) ) ;
5353 }
5454 newNode . attributes . push ( toJsxAttribute ( 'style' , { maxWidth : '100%' , ...style } ) ) ;
55- newNode . attributes . push ( toJsxAttribute ( 'controls' , '' ) ) ;
55+ if ( ! ( 'controls' in attributes ) || attributes . controls ) {
56+ newNode . attributes . push ( toJsxAttribute ( 'controls' , '' ) ) ;
57+ }
5658 newNode . children . push ( {
5759 type : 'mdxJsxFlowElement' ,
5860 name : 'source' ,
Original file line number Diff line number Diff line change @@ -49,6 +49,18 @@ describe('#medialinks', () => {
4949 "
5050 ` ) ;
5151 } ) ;
52+ it ( 'respects controls=false for video' , async ( ) => {
53+ const input = `
54+ ::video[./bunny.mp4]{controls=false}
55+ ` ;
56+ const result = await process ( input ) ;
57+ expect ( result ) . toMatchInlineSnapshot ( `
58+ "<video style={{"maxWidth":"100%"}}>
59+ <source src={require('./bunny.mp4').default} />
60+ </video>
61+ "
62+ ` ) ;
63+ } ) ;
5264 it ( 'can convert audio directive' , async ( ) => {
5365 const input = `
5466 ::audio[./song.mp3]
You can’t perform that action at this time.
0 commit comments