javascript - Inserting image to an editor -
i using summer note editor , want upload image folder when user select image file , @ same time want insert image editor, how can achieve that, have code upload image folder not editor...
$(document).ready(function() { $('#summernote').summernote({ height: 510, 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: 'savetheuploadedfile.php', cache: false, contenttype: false, processdata: false, success: function(url) { editor.insertimage(weleditable, url); } }); } });
i got answer, rather using editor object, replace
editor.insertimage(weleditable,url);
with
$('#summernote').summernote('editor.insertimage',url);
Comments
Post a Comment