Просмотр исходного кода

BugFix: retrieve MathJax from window

Yuki Takei 8 лет назад
Родитель
Сommit
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]);
   }