2017-10-04 107 views
0

我在ckeditor中使用數學公式,當我通過textarea插入新內容時,它可以讀取數學公式,但是如果我編輯此內容,它似乎無法讀取和顯示文本公式之前..編輯ckeditor內容時無法讀取數學公式

這是我的源:

<head> 
<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['\\(','\\)']]}});</script>  
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> 
<script src="https://cdn.ckeditor.com/4.7.3/standard/ckeditor.js"> </script> 
</head> 

<body> 
<table border="0" width="100%" cellspacing="0" cellpadding="0"> 
    <tr> 
     <td valign="top"> 
      <span >Question Code : <%=id_q%>&nbsp;-&nbsp;<%=valid_types%>&nbsp;(Number presented : <%=make_cnt%>)</span> 
     <table border="0"> 
     <tr> 
     <td width="640" height="650"> 
      <textarea name="ir1" id="ir1" rows="1" cols="10" style="width:580px; height:600px; min-width:400px; min-height:50px; display:none;"></textarea>      
      <script> 
       var ir1 = CKEDITOR.replace('ir1', {          
       extraPlugins: 'mathjax,video,font,justify,preview,colorbutton,panelbutton', 
       mathJaxLib: 'https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-AMS_HTML' 
       }); 
       CKFinder.setupCKEditor(ir1, 'libraries/ckfinder/'); 
      </script> 
     </td>   
    </tr> 
</table> 
</body> 

這是結果,當我cliked內容編輯按鈕: enter image description here

如何CKEditor的正確顯示mathjax當編輯內容?感謝

+0

在瀏覽器開發控制檯中是否有任何錯誤?也請嘗試關閉任何第三方插件,然後檢查它是否仍然無法使用。 – f1ames

+0

Hi @ f1ames:我已經檢查開發控制檯,它似乎不是錯誤,我不明白第三方插件,你能告訴更多關於這個嗎? – luongkhanh

+0

第三方插件我的意思是所有不是由CKSource開發的插件(這裏是由CKSource開發的所有插件列表 - https://ckeditor.com/cke4/users/CKSource)。還有一個問題,你能提供一個在CKEditor中設置的輸入/數據(或者CKEditor初始化時在textarea中存在的輸入/數據)嗎? – f1ames

回答

0

你可以嘗試到MathJax腳本移動到你的頭標記的像這樣的底部:

<head>    
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> 
     <script src="https://cdn.ckeditor.com/4.7.3/standard/ckeditor.js"></script> 
     <script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['\\(','\\)']]}});</script>  
    </head> 

,以確保代碼可以訪問MathJax命名空間。

+0

嗨@schwaber:我試過了,它也是一樣的錯誤 – luongkhanh