Commit e7ff0184 by bergquist

feat(table): uses lodash to escape html

parent 6ba5471b
...@@ -96,7 +96,7 @@ export class TableRenderer { ...@@ -96,7 +96,7 @@ export class TableRenderer {
renderCell(columnIndex, value, addWidthHack = false) { renderCell(columnIndex, value, addWidthHack = false) {
value = this.formatColumnValue(columnIndex, value); value = this.formatColumnValue(columnIndex, value);
value = this.encodeHtml(value); value = _.escape(value);
var style = ''; var style = '';
if (this.colorState.cell) { if (this.colorState.cell) {
style = ' style="background-color:' + this.colorState.cell + ';color: white"'; style = ' style="background-color:' + this.colorState.cell + ';color: white"';
...@@ -141,17 +141,4 @@ export class TableRenderer { ...@@ -141,17 +141,4 @@ export class TableRenderer {
return html; return html;
} }
encodeHtml(unsafe) {
return unsafe.replace(/[&<>"']/g, function(m) {
return ({
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#039;',
'/': '&#x2F;'
})[m];
});
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment