From 23975d5a70e24d3f90dd4c6e24231fa3d1752d10 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 11 Aug 2020 20:13:56 +0530 Subject: [PATCH] feat: catch exceptions on tokenizing values in get_value --- frappe/public/js/frappe/form/controls/text_editor.js | 7 ++++++- 1 file changed, 6 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 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; },