Kindeditor初始化、及初始化编辑内容


一、Kindeeitor
- 下载好后放入指定文件夹 引用
<head>
    <meta charset="UTF-8">
    <title>NewsAdd</title>
    <link href="/static/bootstrap3/css/bootstrap.css" rel="stylesheet">
    <link href="/static/plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <script type="text/javascript" src="/static/kindeditor/kindeditor-all-min.js"></script>
</head>
  • 初始化
        KindEditor.ready(function (k) {
            editor=k.create(
                "#article-content",
                {
                    items:[
                            'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                            'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                            'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                            'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                            'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
                             'insertfile', 'table', 'hr', 'pagebreak',
                            'anchor', 'link', 'unlink'
                    ],
                    allowPreviewEmoticons : false,
                    // 去掉远程上传的功能
                    allowImageRemote : false,
                    uploadJson : '/upload/image/',
                    afterBlur: function () { this.sync(); }
                }
            );

        });
  • 初始化编辑内容
        var initInterval = setInterval(function () {
            if(articleObj!=null&&editor!=null){
                editor.html(articleObj.content.replace(/\n\t/g,''));
                editor.sync();
                clearInterval(initInterval);
            }
        },100);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM