fix: update escape_html to escape quotes
previous jquery hack didn't escape double quotes.
This commit is contained in:
parent
9b2946d234
commit
bf6d336e95
1 changed files with 16 additions and 1 deletions
|
|
@ -220,8 +220,23 @@ Object.assign(frappe.utils, {
|
|||
});
|
||||
return out.join(newline);
|
||||
},
|
||||
|
||||
|
||||
escape_html: function(txt) {
|
||||
return $("<div></div>").text(txt || "").html();
|
||||
let escape_html_mapping = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/',
|
||||
'`': '`',
|
||||
'=': '='
|
||||
};
|
||||
|
||||
return String(txt).replace(/[&<>"'`=/]/g, function(char) {
|
||||
return escape_html_mapping[char];
|
||||
});
|
||||
},
|
||||
|
||||
html2text: function(html) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue