From 0dfd3ae0aee9c28c55edabc3544357809ac0c53d Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 18 Jan 2019 13:00:20 +0530 Subject: [PATCH] fix(quill): Convert ol to ul before sending the value to server --- .../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 = $('