@@ -418,6 +418,10 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
418418 Core . prototype . initAddons = function ( ) {
419419 var that = this ;
420420
421+ if ( ! this . options . addons || this . options . addons . length === 0 ) {
422+ return ;
423+ }
424+
421425 $ . each ( this . options . addons , function ( addon , options ) {
422426 var addonName = pluginName + ucfirst ( addon ) ;
423427
@@ -1437,7 +1441,7 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
14371441 captions : true ,
14381442 captionPlaceholder : 'Type caption for image (optional)' ,
14391443 autoGrid : 3 ,
1440- formData : { } , // DEPRECATED: Use fileUploadOptions instead
1444+ formData : null , // DEPRECATED: Use fileUploadOptions instead
14411445 fileUploadOptions : { // See https://github.com/blueimp/jQuery-File-Upload/wiki/Options
14421446 url : 'upload.php' ,
14431447 acceptFileTypes : / ( \. | \/ ) ( g i f | j p e ? g | p n g ) $ / i
@@ -1783,17 +1787,20 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
17831787
17841788 Images . prototype . showImage = function ( img , data ) {
17851789 var $place = this . $el . find ( '.medium-insert-active' ) ,
1786- domImage ;
1790+ domImage ,
1791+ that ;
17871792
17881793 // Hide editor's placeholder
17891794 $place . click ( ) ;
17901795
17911796 // If preview is allowed and preview image already exists,
17921797 // replace it with uploaded image
1798+ that = this ;
17931799 if ( this . options . preview && data . context ) {
17941800 domImage = this . getDOMImage ( ) ;
17951801 domImage . onload = function ( ) {
17961802 data . context . find ( 'img' ) . attr ( 'src' , domImage . src ) ;
1803+ that . $el . trigger ( 'input' ) ;
17971804 } ;
17981805 domImage . src = img ;
17991806 } else {
0 commit comments