瀏覽代碼

BugFix: retrieve MathJax from window

Yuki Takei 8 年之前
父節點
當前提交
83a467f079
共有 1 個文件被更改,包括 4 次插入0 次删除
  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() {
+    const MathJax = window.MathJax;
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxOnInit) {
       const intervalId = setInterval(() => {
         if (MathJax.isReady) {
@@ -19,18 +20,21 @@ export default class RevisionBody extends React.Component {
   }
 
   componentDidUpdate() {
+    const MathJax = window.MathJax;
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxInRealtime) {
       this.renderMathJax();
     }
   }
 
   componentWillReceiveProps(nextProps) {
+    const MathJax = window.MathJax;
     if (MathJax != null && this.props.isMathJaxEnabled && this.props.renderMathJaxOnInit) {
       this.renderMathJax();
     }
   }
 
   renderMathJax() {
+    const MathJax = window.MathJax;
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, this.element]);
   }