Merge pull request #11230 from scmmishra/fix-quill-formatter
refactor: catch exceptions in formatters for text editor
This commit is contained in:
commit
1beaaa5875
2 changed files with 12 additions and 2 deletions
|
|
@ -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 = `<div class="ql-editor read-mode">${value}</div>`;
|
||||
}
|
||||
} catch(e) {
|
||||
value = `<div class="ql-editor read-mode">${value}</div>`;
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = `<div class="ql-editor read-mode">${formatted_value}</div>`;
|
||||
}
|
||||
} catch(e) {
|
||||
formatted_value = `<div class="ql-editor read-mode">${formatted_value}</div>`;
|
||||
}
|
||||
|
||||
return formatted_value;
|
||||
},
|
||||
Code: function(value) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue