Merge pull request #6783 from netchampfaris/fix-quill-ol-to-ul
fix(quill): Convert ol to ul before sending the value to server
This commit is contained in:
commit
d1418781fa
1 changed files with 14 additions and 1 deletions
|
|
@ -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 = $(`<div>${value}</div>`);
|
||||
$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 = $('<ul>').append($children);
|
||||
$parent.replaceWith($ul);
|
||||
});
|
||||
value = $value.html();
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue