tornado + kindeditor

之前在django 中就用的是kindeditor,现在也试着把kindeditor整合到tornado 中。

但是有一点不同的是,我的kindeditor是异步加载的,所以方法会比较不同。

官方参考 :http://www.kindsoft.net/ke4/examples/dynamic-load.html

 

<script charset="utf-8" src="/static/kindeditor/kindeditor.js"></script> 
<script charset="utf-8" src="/static/kindeditor/lang/zh_CN.js"></script> 
<script charset="utf-8" src="/static/kindeditor/plugins/code/prettify.js"></script> 
<script>
    var editor ;
    $.getScript('/static/kindeditor/kindeditor.js',function(){
        KindEditor.basePath = "/static/kindeditor/";
        var options = {  
            cssPath : ('/themes/default/default.css',  
                       '/plugins/code/prettify.css'), 
            width : '600px',  
            height : '100px',  
            filterMode : true,
            uploadJson : KindEditor.undef('/upload'),
            extraFileUploadParams : {
                //csrfmiddlewaretoken:csrftoken
            },
            items :[
                  'code', 'justifyleft', 'justifycenter', 'justifyright',
                  'justifyfull', 'insertorderedlist', 'insertunorderedlist',
                  'superscript','formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                  'italic', 'underline', 'strikethrough', 'image', 'multiimage',
                  'table',  'emoticons','link',
           ]
           };
        KindEditor.create('textarea[name="body"]',options);
    });
</script> 

 

 

posted @ 2012-12-04 15:33  notewo  阅读(458)  评论(1编辑  收藏  举报