fix: lesson youtube video issue
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div v-if="youtube">
|
||||
<iframe
|
||||
class="youtube-video"
|
||||
:src="getYouTubeVideoSource(youtube)"
|
||||
:src="getYouTubeVideoSource(youtube.split('/').pop())"
|
||||
width="100%"
|
||||
height="400"
|
||||
frameborder="0"
|
||||
@@ -54,6 +54,7 @@
|
||||
</div>
|
||||
<div v-else v-html="markdown.render(block)"></div>
|
||||
</div>
|
||||
{{ quizId }}
|
||||
<div v-if="quizId">
|
||||
<Quiz :quiz="quizId" />
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div v-if="quiz.doc.time" class="leading-relaxed">
|
||||
{{
|
||||
__(
|
||||
'The quiz has a time limit.For each question you will be given { 0} seconds.'
|
||||
'The quiz has a time limit.For each question you will be given {0} seconds.'
|
||||
).format(quiz.doc.time)
|
||||
}}
|
||||
</div>
|
||||
|
||||
@@ -208,6 +208,16 @@ const lessonReference = createResource({
|
||||
|
||||
const convertToJSON = (lessonData) => {
|
||||
let blocks = []
|
||||
if (lessonData.youtube) {
|
||||
let youtubeID = lessonData.youtube.split('/').pop()
|
||||
blocks.push({
|
||||
type: 'embed',
|
||||
data: {
|
||||
service: 'youtube',
|
||||
embed: `https://www.youtube.com/embed/${youtubeID}`,
|
||||
},
|
||||
})
|
||||
}
|
||||
lessonData.body.split('\n').forEach((block) => {
|
||||
if (block.includes('{{ YouTubeVideo')) {
|
||||
let youtubeID = block.match(/\(["']([^"']+?)["']\)/)[1]
|
||||
@@ -291,6 +301,16 @@ const convertToJSON = (lessonData) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (lessonData.quizId) {
|
||||
blocks.push({
|
||||
type: 'quiz',
|
||||
data: {
|
||||
quiz: lessonData.quizId,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return blocks
|
||||
}
|
||||
|
||||
|
||||
@@ -1769,6 +1769,8 @@ def get_lesson_creation_details(course, chapter, lesson):
|
||||
"content",
|
||||
"instructor_notes",
|
||||
"instructor_content",
|
||||
"youtube",
|
||||
"quiz_id",
|
||||
],
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user