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

HUE-6077 [frontend] Dropped MathJax

Enrico Berti 8 жил өмнө
parent
commit
0c5a6136f8

+ 1 - 1
desktop/conf.dist/hue.ini

@@ -94,7 +94,7 @@
   ## secure_browser_xss_filter=true
   ## secure_browser_xss_filter=true
 
 
   # X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.
   # X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.
-  ## secure_content_security_policy="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net *.mathjax.org data:;img-src 'self' *.google-analytics.com *.doubleclick.net http://*.tile.osm.org *.tile.osm.org *.gstatic.com data:;style-src 'self' 'unsafe-inline' fonts.googleapis.com;connect-src 'self';child-src 'self' data: *.vimeo.com;object-src 'none'"
+  ## secure_content_security_policy="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net data:;img-src 'self' *.google-analytics.com *.doubleclick.net http://*.tile.osm.org *.tile.osm.org *.gstatic.com data:;style-src 'self' 'unsafe-inline' fonts.googleapis.com;connect-src 'self';child-src 'self' data: *.vimeo.com;object-src 'none'"
 
 
   # Strict-Transport-Security HTTP Strict Transport Security(HSTS) is a policy which is communicated by the server to the user agent via HTTP response header field name “Strict-Transport-Security”. HSTS policy specifies a period of time during which the user agent(browser) should only access the server in a secure fashion(https).
   # Strict-Transport-Security HTTP Strict Transport Security(HSTS) is a policy which is communicated by the server to the user agent via HTTP response header field name “Strict-Transport-Security”. HSTS policy specifies a period of time during which the user agent(browser) should only access the server in a secure fashion(https).
   ## secure_ssl_redirect=False
   ## secure_ssl_redirect=False

+ 1 - 1
desktop/conf/pseudo-distributed.ini.tmpl

@@ -98,7 +98,7 @@
   ## secure_browser_xss_filter=true
   ## secure_browser_xss_filter=true
 
 
   # X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.
   # X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.
-  ## secure_content_security_policy="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net *.mathjax.org data:;img-src 'self' *.google-analytics.com *.doubleclick.net http://*.tile.osm.org *.tile.osm.org *.gstatic.com data:;style-src 'self' 'unsafe-inline' fonts.googleapis.com;connect-src 'self';child-src 'self' data: *.vimeo.com;object-src 'none'"
+  ## secure_content_security_policy="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net data:;img-src 'self' *.google-analytics.com *.doubleclick.net http://*.tile.osm.org *.tile.osm.org *.gstatic.com data:;style-src 'self' 'unsafe-inline' fonts.googleapis.com;connect-src 'self';child-src 'self' data: *.vimeo.com;object-src 'none'"
 
 
   # Strict-Transport-Security HTTP Strict Transport Security(HSTS) is a policy which is communicated by the server to the user agent via HTTP response header field name “Strict-Transport-Security”. HSTS policy specifies a period of time during which the user agent(browser) should only access the server in a secure fashion(https).
   # Strict-Transport-Security HTTP Strict Transport Security(HSTS) is a policy which is communicated by the server to the user agent via HTTP response header field name “Strict-Transport-Security”. HSTS policy specifies a period of time during which the user agent(browser) should only access the server in a secure fashion(https).
   ## secure_ssl_redirect=False
   ## secure_ssl_redirect=False

+ 1 - 1
desktop/core/src/desktop/conf.py

@@ -228,7 +228,7 @@ SECURE_CONTENT_SECURITY_POLICY = Config(
   key="secure_content_security_policy",
   key="secure_content_security_policy",
   help=_('X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.'),
   help=_('X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.'),
   type=str,
   type=str,
-  default="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net *.mathjax.org data:;"+
+  default="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net data:;"+
           "img-src 'self' *.google-analytics.com *.doubleclick.net http://*.tile.osm.org *.tile.osm.org *.gstatic.com data:;"+
           "img-src 'self' *.google-analytics.com *.doubleclick.net http://*.tile.osm.org *.tile.osm.org *.gstatic.com data:;"+
           "style-src 'self' 'unsafe-inline' fonts.googleapis.com;"+
           "style-src 'self' 'unsafe-inline' fonts.googleapis.com;"+
           "connect-src 'self';"+
           "connect-src 'self';"+

+ 1 - 49
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -164,15 +164,6 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 <script src="${ static('desktop/js/ace/mode-hive.js') }"></script>
 <script src="${ static('desktop/js/ace/mode-hive.js') }"></script>
 <script src="${ static('desktop/js/ace/ext-language_tools.js') }"></script>
 <script src="${ static('desktop/js/ace/ext-language_tools.js') }"></script>
 <script src="${ static('desktop/js/ace.extended.js') }"></script>
 <script src="${ static('desktop/js/ace.extended.js') }"></script>
-
-<script type="text/x-mathjax-config">
-  MathJax.Hub.Config({
-    showProcessingMessages: false,
-    tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] },
-    TeX: { equationNumbers: {autoNumber: "AMS"} }
-  });
-</script>
-
 <script src="${ static('desktop/ext/js/download.min.js') }"></script>
 <script src="${ static('desktop/ext/js/download.min.js') }"></script>
 
 
 <%namespace name="dashboard" file="/common_dashboard.mako" />
 <%namespace name="dashboard" file="/common_dashboard.mako" />
@@ -1988,44 +1979,10 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
     $(".hoverMsg").addClass("hide");
     $(".hoverMsg").addClass("hide");
   };
   };
 
 
-  function escapeMathJax(code) {
-    var escapeMap = {
-      "&": "&amp;",
-      "<": "&lt;",
-      ">": "&gt;",
-      '"': "&quot;",
-      "'": "&#x27;",
-      "`": "&#x60;"
-    };
-    var escaper = function (match) {
-      return escapeMap[match];
-    };
-    var source = "(?:" + Object.keys(escapeMap).join("|") + ")";
-    var testRegexp = RegExp(source);
-    var replaceRegexp = RegExp(source, "g");
-    code = code == null ? "" : "" + code;
-    return testRegexp.test(code) ? string.replace(replaceRegexp, escaper) : code;
-  }
-
-  var mathJaxTimeout = 0;
-
-  if (typeof MathJax == "undefined") {
-    escapeMathJax = function (code) {
-      return code;
-    }
-  }
-
   function renderMarkdown(text, snippetId) {
   function renderMarkdown(text, snippetId) {
-    window.clearTimeout(mathJaxTimeout);
-
     text = text.replace(/([^$]*)([$]+[^$]*[$]+)?/g, function (a, text, code) {
     text = text.replace(/([^$]*)([$]+[^$]*[$]+)?/g, function (a, text, code) {
-      return markdown.toHTML(text).replace(/^<p>|<\/p>$/g, '') + (code ? escapeMathJax(code) : '');
+      return markdown.toHTML(text).replace(/^<p>|<\/p>$/g, '') + (code ? code : '');
     });
     });
-    if (typeof MathJax != "undefined") {
-      mathJaxTimeout = window.setTimeout(function () {
-        MathJax.Hub.Queue(["Typeset", MathJax.Hub, $("#liveMD" + snippetId)[0]]);
-      }, 500);
-    }
     return text;
     return text;
   }
   }
 
 
@@ -3599,11 +3556,6 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
       });
       });
     });
     });
   })();
   })();
-
-  var mathjax = document.createElement("script");
-  mathjax.src = "//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
-  mathjax.async = false;
-  document.head.appendChild(mathjax);
 </script>
 </script>
 
 
 </%def>
 </%def>