Преглед изворни кода

Merge pull request #1818 from kaishuu0123/support/workaround-mathjax-rendering

Workaround MathJax rendering.
Yuki Takei пре 6 година
родитељ
комит
42a3d53b86
1 измењених фајлова са 13 додато и 1 уклоњено
  1. 13 1
      src/client/js/components/Page/RevisionBody.jsx

+ 13 - 1
src/client/js/components/Page/RevisionBody.jsx

@@ -35,7 +35,19 @@ export default class RevisionBody extends React.PureComponent {
 
   renderMathJax() {
     const MathJax = window.MathJax;
-    MathJax.Hub.Queue(['Typeset', MathJax.Hub, this.element]);
+    // Workaround MathJax Rendering (Errors still occur, but MathJax can be rendered)
+    //
+    // Reason:
+    //   Addition of draw.io Integration causes initialization conflict between MathJax of draw.io and MathJax of GROWI.
+    //   So, before MathJax is initialized, execute renderMathJaxWithDebounce again.
+    //   Avoiding initialization of MathJax of draw.io solves the problem.
+    //   refs: https://github.com/jgraph/drawio/pull/831
+    if (MathJax != null && MathJax.Hub != null) {
+      MathJax.Hub.Queue(['Typeset', MathJax.Hub, this.element]);
+    }
+    else {
+      this.renderMathJaxWithDebounce();
+    }
   }
 
   generateInnerHtml(html) {