Summernote Text Editor with FS Collection


#1

In Summernote official website it says by this we can override default imageUpload

var $summernote = $('#summernote');
$summernote.summernote({
  onImageUpload: function(files) {
    console.log('image upload:', files);
    // upload image to server and create imgNode...
    $summernote.summernote('insertNode', imgNode);
  }
});  

So in meteor to use that using FS collection, here is a code:

Template.postSubmit.rendered = function(){
        $('#edit').summernote({
            onImageUpload: function(file) {
        FS.Utility.eachFile(event, function(file) {
          Images.insert(file, function (err, fileObj) {
            //Inserted new doc with ID fileObj._id, and kicked off the data upload using HTTP
          });
        });
      } 
        });
    };

Now how do i get imgNode, is it the id of the image after upload?? or the image url ??


#2

After the help from a new friend, I’ve got a solution.
It was really a JQuery DOM object

var $dom = $("<img>").attr('src',imagesURL);
$summernote.summernote("insertNode", $dom[0]);