fix(Text Editor): Clear editor when value is falsy

This commit is contained in:
Faris Ansari 2018-10-08 13:06:19 +05:30
parent 34064a322f
commit ee0b116954

View file

@ -102,8 +102,14 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
},
set_formatted_input(value) {
if (!(this.quill && value)) return;
if (!this.quill) return;
if (value === this.get_input_value()) return;
if (!value) {
// clear contents for falsy values like '', undefined or null
this.quill.setText('');
return;
}
this.quill.setText('');
this.quill.clipboard.dangerouslyPasteHTML(0, value);
},