话不多少,直接上干货。

  

function summernote() {
    $(\'.summernote\').summernote({
        height: 200,
        onImageUpload: function(files, editor, welEditable) {
            sendFile(files[0], editor, welEditable);
        }
    });
};

function sendFile(file, editor, welEditable) {
    data = new FormData();
    data.append("file", file);
    $.ajax({
        data: data,
        type: "POST",
        url: "/upload/insert",
        cache: false,
        contentType: false,
        processData: false,
        success: function(url) {
            alert(url);
            editor.insertImage(welEditable, url);
        }
    });
}

summernote.js

 

版权声明:本文为zouchengli原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/zouchengli/p/7202703.html