11/*!
2- * medium-editor-insert-plugin v2.2.2 - jQuery insert plugin for MediumEditor
2+ * medium-editor-insert-plugin v2.2.3 - jQuery insert plugin for MediumEditor
33 *
44 * https://github.com/orthes/medium-editor-insert-plugin
55 *
@@ -89,9 +89,9 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-image.hbs"] = Handleb
8989
9090 return "<figure contenteditable=\"false\">\n <img src=\""
9191 + container . escapeExpression ( ( ( helper = ( helper = helpers . img || ( depth0 != null ? depth0 . img : depth0 ) ) != null ? helper : helpers . helperMissing ) , ( typeof helper === "function" ? helper . call ( alias1 , { "name" :"img" , "hash" :{ } , "data" :data } ) : helper ) ) )
92- + "\" alt=\"\">\n"
92+ + "\" alt=\"\" / >\n"
9393 + ( ( stack1 = helpers [ "if" ] . call ( alias1 , ( depth0 != null ? depth0 . progress : depth0 ) , { "name" :"if" , "hash" :{ } , "fn" :container . program ( 1 , data , 0 ) , "inverse" :container . noop , "data" :data } ) ) != null ? stack1 : "" )
94- + "</figure>" ;
94+ + "</figure>\n " ;
9595} , "useData" :true } ) ;
9696
9797this [ "MediumInsert" ] [ "Templates" ] [ "src/js/templates/images-progressbar.hbs" ] = Handlebars . template ( { "compiler" :[ 7 , ">= 4.0.0" ] , "main" :function ( container , depth0 , helpers , partials , data ) {
@@ -204,7 +204,9 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
204204 this . options . editor . destroy = this . editorDestroy ;
205205 this . options . editor . setup = this . editorSetup ;
206206
207- this . options . editor . getExtensionByName ( 'placeholder' ) . updatePlaceholder = this . editorUpdatePlaceholder ;
207+ if ( this . options . editor . getExtensionByName ( 'placeholder' ) !== undefined ) {
208+ this . options . editor . getExtensionByName ( 'placeholder' ) . updatePlaceholder = this . editorUpdatePlaceholder ;
209+ }
208210 }
209211 }
210212
@@ -320,11 +322,11 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
320322 * @return {void }
321323 */
322324
323- Core . prototype . editorUpdatePlaceholder = function ( el ) {
325+ Core . prototype . editorUpdatePlaceholder = function ( el , dontShow ) {
324326 var contents = $ ( el ) . children ( )
325327 . not ( '.medium-insert-buttons' ) . contents ( ) ;
326328
327- if ( contents . length === 1 && contents [ 0 ] . nodeName . toLowerCase ( ) === 'br' ) {
329+ if ( ! dontShow && contents . length === 1 && contents [ 0 ] . nodeName . toLowerCase ( ) === 'br' ) {
328330 this . showPlaceholder ( el ) ;
329331 this . base . _hideInsertButtons ( $ ( el ) ) ;
330332 } else {
@@ -432,11 +434,7 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
432434 return ;
433435 }
434436
435- // Fix #39
436- // After deleting all content (ctrl+A and delete) in Firefox, all content is deleted and only <br> appears
437- // To force placeholder to appear, set <p><br></p> as content of the $el
438-
439- if ( this . $el . html ( ) . trim ( ) === '' || this . $el . html ( ) . trim ( ) === '<br>' ) {
437+ if ( this . $el . children ( ) . length === 0 ) {
440438 this . $el . html ( this . templates [ 'src/js/templates/core-empty-line.hbs' ] ( ) . trim ( ) ) ;
441439 }
442440
@@ -445,7 +443,7 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
445443 $text = this . $el
446444 . contents ( )
447445 . filter ( function ( ) {
448- return this . nodeName === '#text' && $ . trim ( $ ( this ) . text ( ) ) !== '' ;
446+ return ( this . nodeName === '#text' && $ . trim ( $ ( this ) . text ( ) ) !== '' ) || this . nodeName . toLowerCase ( ) === 'br ';
449447 } ) ;
450448
451449 $text . each ( function ( ) {
0 commit comments