1

我正在使用带有 ckeditor_wiris(数学类型)插件的 ckeditor 4.16 来编写数学和化学方程式。ckeditor 中的方程以正确的格式显示,但是当方程输出到段落或 div 时,方程显示为一条直线。

代码在这里

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta charset="utf-8">
        <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
        <script src="ckeditor/ckeditor.js"></script>
        <script src="ckeditor/plugins/ckeditor_wiris/plugin.js"></script>
        <script src="ckeditor/plugins/ckwebspeech/plugin.js"></script>
    </head>
    <body>
        <form>
            <textarea name="editor1" id="editor1" rows="10" cols="80">
                This is my textarea to be replaced with CKEditor.
            </textarea>
            <script>
                CKEDITOR.replace( 'editor1', {
                    //extraPlugins: 'ckwebspeech,ckeditor_wiris',
                    extraPlugins:'ckeditor_wiris',
                    //extraPlugins:'ckwebspeech',
                    allowedContent: true
                });

            </script>
        </form>
        <button id="submit">submit</button> <br>
        The output of ckeditor math type<br>
        <p id="mathtype"></p>
    </body>
</html>
<script>
$(document).ready(function() {
    $('#submit').click(function(){
        var data = CKEDITOR.instances['editor1'].getData();
        alert(data);
        $('#mathtype').html(data);
    });
    
});
</script>

输出是:

在此处输入图像描述

4

0 回答 0