fix: embed video with spaces in name
This commit is contained in:
@@ -15,6 +15,7 @@ be loaded in a webpage.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
|
||||||
class PageExtension:
|
class PageExtension:
|
||||||
@@ -138,7 +139,9 @@ def youtube_video_renderer(video_id):
|
|||||||
|
|
||||||
|
|
||||||
def video_renderer(src):
|
def video_renderer(src):
|
||||||
return f"<video controls width='100%'><source src={src} type='video/mp4'></video>"
|
return (
|
||||||
|
f"<video controls width='100%'><source src={quote(src)} type='video/mp4'></video>"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def assignment_renderer(detail):
|
def assignment_renderer(detail):
|
||||||
|
|||||||
@@ -263,6 +263,10 @@ class YouTubeVideo {
|
|||||||
</iframe>`;
|
</iframe>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate(savedData) {
|
||||||
|
return !savedData.youtube || !savedData.youtube.trim() ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
save(block_content) {
|
save(block_content) {
|
||||||
return {
|
return {
|
||||||
youtube: this.data.youtube || this.youtube,
|
youtube: this.data.youtube || this.youtube,
|
||||||
@@ -329,6 +333,10 @@ class Quiz {
|
|||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate(savedData) {
|
||||||
|
return !savedData.quiz || !savedData.quiz.trim() ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
save(block_content) {
|
save(block_content) {
|
||||||
return {
|
return {
|
||||||
quiz: this.data.quiz || this.quiz,
|
quiz: this.data.quiz || this.quiz,
|
||||||
@@ -385,6 +393,10 @@ class Upload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate(savedData) {
|
||||||
|
return !savedData.file_url || !savedData.file_url.trim() ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
save(block_content) {
|
save(block_content) {
|
||||||
return {
|
return {
|
||||||
file_url: this.data.file_url || this.file_url,
|
file_url: this.data.file_url || this.file_url,
|
||||||
|
|||||||
Reference in New Issue
Block a user