File tree Expand file tree Collapse file tree 1 file changed +36
-1
lines changed
apps/learneth/src/pages/StepDetail Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,39 @@ function StepDetailPage() {
72
72
)
73
73
}
74
74
75
+ const VideoRenderer = ( {
76
+ node,
77
+ src,
78
+ alt,
79
+ ...props
80
+ } : {
81
+ node ?: any ;
82
+ src ?: string ;
83
+ alt ?: string ;
84
+ [ key : string ] : any ;
85
+ } ) => {
86
+ if ( alt === 'youtube' ) {
87
+ /*
88
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/Eh1qgOurDxU?si=lz1JypmIJZ15OY4g" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
89
+ */
90
+ return (
91
+ < iframe
92
+ /*width="560"
93
+ height="315"*/
94
+ src = { src }
95
+ title = "YouTube video player"
96
+ frameBorder = "0"
97
+ allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
98
+ allowFullScreen
99
+ />
100
+ ) ;
101
+ }
102
+ if ( alt === 'video' ) {
103
+ return < video controls src = { src } style = { { maxWidth : '100%' } } /> ;
104
+ }
105
+ return < img src = { src } alt = { alt } { ...props } /> ;
106
+ } ;
107
+
75
108
return (
76
109
< div className = 'pb-4' >
77
110
< div className = "fixed-top" >
@@ -104,7 +137,9 @@ function StepDetailPage() {
104
137
</ >
105
138
) }
106
139
< div className = "container-fluid" >
107
- < Markdown rehypePlugins = { [ rehypeRaw ] } > { clonedStep . markdown ?. content } </ Markdown >
140
+ < Markdown components = { {
141
+ img : VideoRenderer
142
+ } } rehypePlugins = { [ rehypeRaw ] } > { clonedStep . markdown ?. content } </ Markdown >
108
143
</ div >
109
144
{ clonedStep . test ?. content ? (
110
145
< >
You can’t perform that action at this time.
0 commit comments