JavaScript Summernote wraps <p><br></p> for insertNode()

I am trying to insert a simple img tag into the editor.

jQuery('<img />').attr('src', '/uploads/images/' + res.data.filename);
jQuery('.summernote').summernote('insertNode', $image[0]);

I expect to see

<img src="/uploads/images/image.jpg" />

What I am getting is

<p><br><img src="/uploads/images/image.jpg" /></p>

I even append the image object into a paragraph object but then I get <p><br></p> before and after the node.

Not seeing this behavior obviously written in the plugin source file.

Has anyone applied custom functions to just insert in the plain node?

Answer:1

Try to use 'insertImage' function instead of 'insertNode'.
Here is the docs: insertImage

Answer:2

Understand why it adds the wrapper when I am inserting a node on a new line. It's there as soon as I add a new line that it creates the wrapper aleready.

Answer:3

I'm trying to implement nested components in Ember 2.0.1, but I'm getting a strange behavior when use toggleProperty function inside of the action handler. The first component looks like: // ./...

I'm trying to implement nested components in Ember 2.0.1, but I'm getting a strange behavior when use toggleProperty function inside of the action handler. The first component looks like: // ./...

I'm having a problem where render is being called autimatically in my Marionette CompositeView which is correct, the problem is that I'm fetching collection data in the initialize and want this to be ...

I'm having a problem where render is being called autimatically in my Marionette CompositeView which is correct, the problem is that I'm fetching collection data in the initialize and want this to be ...

I am having an issue centring a <div id='divTwo'> inside another <div id='divOne'>. This is normal an easy thing to do, however in this instance i have transform: scale(); with transform-...

I am having an issue centring a <div id='divTwo'> inside another <div id='divOne'>. This is normal an easy thing to do, however in this instance i have transform: scale(); with transform-...

I am using Phonegap and jQuery to develop an app. I have a bit of a bug that has me stumped. I have a back button which looks like this: <div data-role="header"> <a id="...

I am using Phonegap and jQuery to develop an app. I have a bit of a bug that has me stumped. I have a back button which looks like this: <div data-role="header"> <a id="...