Skip to content

Commit 72c43a0

Browse files
author
Dennis Suitters
authored
Merge pull request #62 from rgutierrez-cotech/add-image-link-insert-doc
Add documentation for onImageLinkInsert callback
2 parents 24fa9f2 + 13dfcdd commit 72c43a0

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

01-deep-dive.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,27 @@ $('#summernote').on('summernote.blur.codeview', function() {
928928
{% endhighlight %}
929929

930930
### onImageLinkInsert
931-
WIP: Need to work on an explanation
931+
Override insertion of image by url
932+
933+
{% highlight javascript %}
934+
// onImageLinkInsert callback
935+
$('#summernote').summernote({
936+
callbacks: {
937+
onImageLinkInsert: function(url) {
938+
// url is the image url from the dialog
939+
$img = $('<img>').attr({ src: url })
940+
$summernote.summernote('insertNode', $img[0]);
941+
}
942+
}
943+
});
944+
945+
// summernote.image.link.insert
946+
$('#summernote').on('summernote.image.link.insert', function(we, url) {
947+
// url is the image url from the dialog
948+
$img = $('<img>').attr({ src: url })
949+
$summernote.summernote('insertNode', $img[0]);
950+
});
951+
{% endhighlight %}
932952

933953
### onImageUpload
934954
Override image upload handler(default: base64 dataURL on `IMG` tag).

0 commit comments

Comments
 (0)