Merge pull request #6215 from netchampfaris/quill-clear-editor-fix

fix(Text Editor): Clear editor when value is falsy
This commit is contained in:
Faris Ansari 2018-10-08 13:08:33 +05:30 committed by GitHub
commit 5b2dc66338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);
},