• KindEditor


    首先导入

    <script src="/static/plugins/kindeditor/kindeditor-all.js"></script>


    KindEditor模板套用

    var editor;
    KindEditor.ready(function (K){
    editor=K.create(
    '#id_contentss',//定位富文本框
    {
    resizeType: 1,
    allowPreviewEmoticons: false,
    allowImageUpload: true,
    items: [
    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
    'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
    afterCreate : function() { this.sync(); },//将KindEditor里面写的内容同步到textarea中,这样后台就能获取到
    afterBlur: function(){this.sync();}//如果用form提交的话,就写上标红的部分



    }
    )

    });

    KindEditor传图片预览
    views部分

    def laocunzhang(request):
    ret = {'status': '','msg': ""}
    print(request.POST)
    print(request.FILES)
    dic = {
    'error': 0,
    'url': '/static/imgs/4.jpg',
    'message': '错误了...'
    }

    return JsonResponse(dic)

    template部分

    <script charset="utf-8" src="/static/plugins/kindeditor/kindeditor-min.js"></script>
    <script charset="utf-8" src="/static/plugins/kindeditor/lang/zh_CN.js"></script>
    <script>
    var editor;
    KindEditor.ready(function (K) {
    editor = K.create('textarea[name="content"]', {
    resizeType: 1,
    allowPreviewEmoticons: false,
    allowImageUpload: false,
    items: [
    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
    'insertunorderedlist', '|', 'emoticons', 'image', 'link'],

    url:'/laocunzhang'
    });
    });
    </script>

    在前端获取KindEditor中的值通过editor.html()






    Java学习内容
  • 相关阅读:
    GPS 经纬度
    TP5 分页数据加锚点
    修改layui的表单手机、邮箱验证可以为空怎么实现?
    转录调控实战 | 一文解决转录调控问题 | chIP-seq | ATAC-seq
    管家基因 | Human housekeeping genes
    各国脑计划概览
    原创
    RLE Plots: relative log expression
    Polygenic score
    皮尔逊残差 | Pearson residual
  • 原文地址:https://www.cnblogs.com/wangtc/p/10728336.html
Copyright © 2020-2023  润新知