feat(table): uses lodash to escape html

This commit is contained in:
bergquist
2016-02-09 11:05:11 +01:00
parent 6ba5471bd4
commit e7ff018487

View File

@@ -96,7 +96,7 @@ export class TableRenderer {
renderCell(columnIndex, value, addWidthHack = false) {
value = this.formatColumnValue(columnIndex, value);
value = this.encodeHtml(value);
value = _.escape(value);
var style = '';
if (this.colorState.cell) {
style = ' style="background-color:' + this.colorState.cell + ';color: white"';
@@ -141,17 +141,4 @@ export class TableRenderer {
return html;
}
encodeHtml(unsafe) {
return unsafe.replace(/[&<>"']/g, function(m) {
return ({
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#039;',
'/': '&#x2F;'
})[m];
});
}
}