Skip to content

Commit

Permalink
fix: strip html and show text (#22656) (#22676)
Browse files Browse the repository at this point in the history
* fix: strip html and show text

Quill editor adds html which is useless for user so strip html using  html2text and render Text only. If no text is found it will render No Text Found in + "Field Label" (ex. Description).

* fix: remove placeholder text

[skip ci]

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 7752136)

Co-authored-by: Maharshi Patel <39730881+maharshivpatel@users.noreply.github.com>
  • Loading branch information
mergify[bot] and maharshivpatel committed Oct 10, 2023
1 parent 2c267ea commit d371d59
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,11 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
link.dataset.doctype = this.doctype;
link.dataset.name = doc.name;
link.href = this.get_form_link(doc);
link.title = value.toString();
link.textContent = value.toString();
// "Text Editor" and some other fieldtypes can have html tags in them so strip and show text.
// If no text is found show "No Text Found in {Field Label}"
let textValue = frappe.utils.html2text(value);
link.title = textValue;
link.textContent = textValue;

return div.innerHTML;
}
Expand Down

0 comments on commit d371d59

Please sign in to comment.