Selaa lähdekoodia

feat(table): uses lodash to escape html

bergquist 10 vuotta sitten
vanhempi
commit
e7ff018487
1 muutettua tiedostoa jossa 1 lisäystä ja 14 poistoa
  1. 1 14
      public/app/plugins/panel/table/renderer.ts

+ 1 - 14
public/app/plugins/panel/table/renderer.ts

@@ -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];
-    });
-  }
 }