From ee0b116954ae5a663da7451e00a33a71835f5dbc Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 8 Oct 2018 13:06:19 +0530 Subject: [PATCH] fix(Text Editor): Clear editor when value is falsy --- frappe/public/js/frappe/form/controls/text_editor.js | 8 +++++++- 1 file changed, 7 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 cba40706b1..0e00ae5294 100644 --- a/frappe/public/js/frappe/form/controls/text_editor.js +++ b/frappe/public/js/frappe/form/controls/text_editor.js @@ -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); },