编辑ckeditor内容时无法读取数学公式

问题描述:

我在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

你可以尝试到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