1、jsp中引入ueditor和kityformula脚本
<script type="text/javascript" src="${path}/js/ueditor/ueditor.config.js"></script> <script type="text/javascript" src="${path}/js/ueditor/ueditor.all.min.js"></script> <script type="text/javascript" src="${path}/js/ueditor/lang/zh-cn/zh-cn.js"></script> <script type="text/javascript" src="${path}/js/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script> <script type="text/javascript" src="${path}/js/ueditor/kityformula-plugin/getKfContent.js"></script> <script type="text/javascript" src="${path}/js/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
jsp中实例化ueditor
<script type="text/javascript"> var stemEditor = UE.getEditor('stemEditor', { toolbars: [[ 'fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'directionalityltr', 'directionalityrtl', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|', 'simpleupload', 'insertframe', 'insertcode', 'pagebreak', '|', 'horizontal', 'date', 'time', 'spechars', '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|', 'print', 'preview', 'searchreplace', 'kityformula' ]], autoHeightEnabled: true, autoFloatEnabled: false }); stemEditor.ready(function() { //设置编辑器的内容 // if(isEdit=="true"){ stemEditor.execCommand("insertHtml",$("#stemContent").val()); // } }); </script> <div> <script id="stemEditor" type="text/plain" style="width:100%;height:400px;"></script> <textarea id="stemContent" name="stemContent" style="display: none;">数据回显承载元素</textarea> </div>
2、整合kityformula-plugin公式插件
修改对应配置
kityFormulaDialog.html文件改写成jsp文件,并对其中对应的js css引用路径进行修改