diff --git a/lms/www/batch/learn.js b/lms/www/batch/learn.js
index 50178845..620c2b53 100644
--- a/lms/www/batch/learn.js
+++ b/lms/www/batch/learn.js
@@ -542,7 +542,6 @@ const build_attachment_table = (file_doc) => {
const make_editor = () => {
-
this.code_field_group = new frappe.ui.FieldGroup({
fields: [
{
diff --git a/lms/www/courses/course.html b/lms/www/courses/course.html
index 4fdaf48e..e4c24cc4 100644
--- a/lms/www/courses/course.html
+++ b/lms/www/courses/course.html
@@ -205,9 +205,13 @@
{% macro Description(course) %}
-
{% if course.description %}{{ frappe.utils.md_to_html(course.description) }}{% endif %}
+ {% if course.edit_mode %}
+
+ {% else %}
+
+ {{ frappe.utils.md_to_html(course.description) }}
+
+ {% endif %}
{% endmacro %}
@@ -419,3 +423,9 @@
{% endmacro %}
+
+
+{% block base_scripts %}
+ {{ include_script("frappe-web.bundle.js") }}
+ {{ include_script('controls.bundle.js') }}
+{% endblock %}
diff --git a/lms/www/courses/course.js b/lms/www/courses/course.js
index 0669f119..06fbec3e 100644
--- a/lms/www/courses/course.js
+++ b/lms/www/courses/course.js
@@ -70,6 +70,10 @@ frappe.ready(() => {
remove_tag(e);
});
+ if ($("#description").length) {
+ make_editor();
+ }
+
});
@@ -338,7 +342,7 @@ const save_course = (e) => {
"short_introduction": $("#intro").text(),
"video_link": $("#video-link").text(),
"image": $("#image").attr("href"),
- "description": $("#description").text(),
+ "description": this.code_field_group.fields_dict["code_md"].value,
"course": $("#title").data("course") ? $("#title").data("course") : "",
"published": $("#published").prop("checked") ? 1 : 0,
"upcoming": $("#upcoming").prop("checked") ? 1 : 0
@@ -359,3 +363,26 @@ const save_course = (e) => {
const remove_tag = (e) => {
$(e.currentTarget).closest(".course-card-pills").remove();
};
+
+
+const make_editor = () => {
+ this.code_field_group = new frappe.ui.FieldGroup({
+ fields: [
+ {
+ fieldname: "code_md",
+ fieldtype: "Code",
+ options: "Markdown",
+ wrap: true,
+ max_lines: Infinity,
+ min_lines: 20,
+ default: $("#description").data("description"),
+ depends_on: 'eval:doc.type=="Markdown"',
+ }
+ ],
+ body: $("#description").get(0),
+ });
+ this.code_field_group.make();
+ $("#description .form-section:last").removeClass("empty-section");
+ $("#description .frappe-control").removeClass("hide-control");
+ $("#description .form-column").addClass("p-0");
+};