[IMP] mail: cleanup '_htmlEscape' usage
We instead use the standard owl.utils.escape. This allows having less custom implementations of escaping and rely on existing tools. Task-2622893 closes odoo/odoo#81293 Related: odoo/enterprise#22850 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { escape } from '@web/core/utils/strings';
|
||||
import emojis from '@mail/js/emojis';
|
||||
|
||||
/**
|
||||
@@ -49,26 +50,13 @@ export default {
|
||||
* @param {String} message a text message to format
|
||||
*/
|
||||
_formatText: function (message) {
|
||||
message = this._htmlEscape(message);
|
||||
message = escape(message);
|
||||
message = this._wrapEmojis(message);
|
||||
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
||||
|
||||
return message;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adapted from qweb2.js#html_escape to avoid formatting '&'
|
||||
*
|
||||
* @param {String} s
|
||||
* @private
|
||||
*/
|
||||
_htmlEscape: function (s) {
|
||||
if (s == null) {
|
||||
return '';
|
||||
}
|
||||
return String(s).replace(/</g, '<').replace(/>/g, '>');
|
||||
},
|
||||
|
||||
/**
|
||||
* Will use the mail.emojis library to wrap emojis unicode around a span with a special font
|
||||
* that will make them look nicer (colored, ...).
|
||||
|
||||
Reference in New Issue
Block a user