diff --git a/frappe/public/js/frappe/form/controls/text_editor.js b/frappe/public/js/frappe/form/controls/text_editor.js
index 3fe0b60ae0..5881e52d74 100644
--- a/frappe/public/js/frappe/form/controls/text_editor.js
+++ b/frappe/public/js/frappe/form/controls/text_editor.js
@@ -201,9 +201,14 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
// hack to retain space sequence.
value = value.replace(/(\s)(\s)/g, ' ');
- if (!$(value).find('.ql-editor').length) {
+ try {
+ if (!$(value).find('.ql-editor').length) {
+ value = `
${value}
`;
+ }
+ } catch(e) {
value = `${value}
`;
}
+
return value;
},
diff --git a/frappe/public/js/frappe/form/formatters.js b/frappe/public/js/frappe/form/formatters.js
index a7adc9175a..39541757a5 100644
--- a/frappe/public/js/frappe/form/formatters.js
+++ b/frappe/public/js/frappe/form/formatters.js
@@ -230,9 +230,14 @@ frappe.form.formatters = {
TextEditor: function(value) {
let formatted_value = frappe.form.formatters.Text(value);
// to use ql-editor styles
- if (!$(formatted_value).find('.ql-editor').length) {
+ try {
+ if (!$(formatted_value).find('.ql-editor').length) {
+ formatted_value = `${formatted_value}
`;
+ }
+ } catch(e) {
formatted_value = `${formatted_value}
`;
}
+
return formatted_value;
},
Code: function(value) {