Эх сурвалжийг харах

[editor] Purged html entities from charts

Enrico Berti 9 жил өмнө
parent
commit
d58cf31f9a

+ 4 - 0
desktop/core/src/desktop/static/desktop/js/hue.utils.js

@@ -116,6 +116,10 @@ Array.prototype.diff = function (a) {
     return $('<div/>').text(value).html();
   };
 
+  hueUtils.html2text = function (value){
+    return $('<div/>').html(value).text();
+  };
+
   hueUtils.goFullScreen = function () {
     if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
       if (document.documentElement.requestFullscreen) {

+ 3 - 3
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1456,7 +1456,7 @@ ${ require.config() }
       });
       $(rawDatum.counts()).each(function (cnt, item) {
         _data.push({
-          label: item[_idxLabel],
+          label: hueUtils.html2text(item[_idxLabel]),
           value: item[_idxValue],
           obj: item
         });
@@ -1525,7 +1525,7 @@ ${ require.config() }
           _data.push({
             lat: item[_idxLat],
             lng: item[_idxLng],
-            label: item[_idxLabel],
+            label: hueUtils.html2text(item[_idxLabel]),
             obj: item
           });
         });
@@ -1565,7 +1565,7 @@ ${ require.config() }
           $(rawDatum.counts()).each(function (cnt, item) {
             _data.push({
               series: _plottedSerie,
-              x: item[_idxLabel],
+              x: hueUtils.html2text(item[_idxLabel]),
               y: item[_idxValue],
               obj: item
             });