feat: text editor for lesson body

This commit is contained in:
Jannat Patel
2023-04-05 14:13:18 +05:30
parent 67dc6d1f29
commit fafd132768
4 changed files with 17 additions and 3 deletions

View File

@@ -66,7 +66,7 @@
},
{
"fieldname": "body",
"fieldtype": "Markdown Editor",
"fieldtype": "Text Editor",
"ignore_xss_filter": 1,
"label": "Body",
"reqd": 1
@@ -135,7 +135,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-12-28 16:01:42.191123",
"modified": "2023-04-05 12:42:16.926753",
"modified_by": "Administrator",
"module": "LMS",
"name": "Course Lesson",

View File

@@ -269,6 +269,7 @@ def get_progress(course, lesson):
def render_html(lesson):
print(lesson.body)
youtube = lesson.youtube
quiz_id = lesson.quiz_id
body = lesson.body

View File

@@ -49,4 +49,5 @@ lms.patches.v0_0.rename_community_to_users #06-01-2023
lms.patches.v0_0.video_embed_link
lms.patches.v0_0.rename_exercise_doctype
lms.patches.v0_0.add_question_type
lms.patches.v0_0.add_evaluator_to_assignment
lms.patches.v0_0.add_evaluator_to_assignment
lms.patches.v0_0.convert_lesson_markdown_to_html #05-04-2023

View File

@@ -0,0 +1,12 @@
import frappe
from lms.lms.md import markdown_to_html
def execute():
lessons = frappe.get_all("Course Lesson", fields=["name", "body"])
for lesson in lessons:
html = markdown_to_html(lesson.body)
frappe.db.set_value("Course Lesson", lesson.name, "body", html)
frappe.reload_doc("lms", "doctype", "course_lesson")