Browse Source

BugFix: retrieve MathJax from window

Yuki Takei 8 years ago
parent
commit
83a467f079
1 changed files with 4 additions and 0 deletions
  1. 4 0
      resource/js/components/Page/RevisionBody.js

+ 4 - 0
resource/js/components/Page/RevisionBody.js

@@ -8,6 +8,7 @@ export default class RevisionBody extends React.Component {
   }
   }
 
 
   componentDidMount() {
   componentDidMount() {
+    const MathJax = window.MathJax;
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxOnInit) {
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxOnInit) {
       const intervalId = setInterval(() => {
       const intervalId = setInterval(() => {
         if (MathJax.isReady) {
         if (MathJax.isReady) {
@@ -19,18 +20,21 @@ export default class RevisionBody extends React.Component {
   }
   }
 
 
   componentDidUpdate() {
   componentDidUpdate() {
+    const MathJax = window.MathJax;
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxInRealtime) {
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxInRealtime) {
       this.renderMathJax();
       this.renderMathJax();
     }
     }
   }
   }
 
 
   componentWillReceiveProps(nextProps) {
   componentWillReceiveProps(nextProps) {
+    const MathJax = window.MathJax;
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxOnInit) {
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxOnInit) {
       this.renderMathJax();
       this.renderMathJax();
     }
     }
   }
   }
 
 
   renderMathJax() {
   renderMathJax() {
+    const MathJax = window.MathJax;
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, this.element]);
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, this.element]);
   }
   }