fix: render fetched Text Editor value as plain text on read only field (#37014)
* fix: render fetched Text Editor value as plain text on read only fields * fix(link): render Text Editor html value as plain text on search fields area * refactor: convert HTML to text only when value contains HTML * refactor: add check `is_val_html` instead of unescape value
This commit is contained in:
parent
92eb6aa7a0
commit
c46226dc7b
2 changed files with 5 additions and 2 deletions
|
|
@ -158,6 +158,7 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
|
|||
}
|
||||
|
||||
set_disp_area(value) {
|
||||
let is_val_html = frappe.utils.is_html(value);
|
||||
if (
|
||||
["Currency", "Int", "Float"].includes(this.df.fieldtype) &&
|
||||
(this.value === 0 || value === 0)
|
||||
|
|
@ -178,7 +179,9 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
|
|||
let display_value = frappe.format(value, this.df, { no_icon: true, inline: true }, doc);
|
||||
// This is used to display formatted output AND showing values in read only fields
|
||||
if (this.disp_area) {
|
||||
$(this.disp_area).html(display_value);
|
||||
$(this.disp_area).html(
|
||||
is_val_html ? frappe.utils.html2text(display_value) : display_value
|
||||
);
|
||||
// Apply alignment only for supported fields
|
||||
if (
|
||||
this.df.alignment &&
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
|
|||
) {
|
||||
html +=
|
||||
'<br><span class="small">' +
|
||||
__(frappe.utils.escape_html(d.description)) +
|
||||
__(frappe.utils.escape_html(frappe.utils.html2text(d.description))) +
|
||||
"</span>";
|
||||
}
|
||||
return $(`<div role="option">`)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue