From 6724b0fd26583bc4067b2db97811d2bf7e20dd64 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 21 Jan 2019 17:42:21 +0530 Subject: [PATCH] fix(quill): Convert ol to ul before sending the value to server (#6795) --- .../public/js/frappe/form/controls/text_editor.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/text_editor.js b/frappe/public/js/frappe/form/controls/text_editor.js index 5203c57e7f..f5dfeb3893 100644 --- a/frappe/public/js/frappe/form/controls/text_editor.js +++ b/frappe/public/js/frappe/form/controls/text_editor.js @@ -181,6 +181,19 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({ }, get_input_value() { - return this.quill ? this.quill.root.innerHTML : ''; + let value = this.quill ? this.quill.root.innerHTML : ''; + // quill keeps ol as a common container for both type of lists + // and uses css for appearances, this is not semantic + // so we convert ol to ul if it is unordered + const $value = $(`
${value}
`); + $value.find('ol li[data-list=bullet]:first-child').each((i, li) => { + let $li = $(li); + let $parent = $li.parent(); + let $children = $parent.children(); + let $ul = $('