diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 47e527eefc..db5ea30153 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -2768,6 +2768,10 @@ } this.controller.on( 'activate', this.refresh, this ); + + this.controller.on( 'detach', function() { + this.$browser.remove(); + }, this ); }, refresh: function() { diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index f62509779b..9129dd204d 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -288,14 +288,14 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { callback = function( imageData ) { updateImage( img, imageData ); editor.focus(); + frame.detach(); }; frame.state('image-details').on( 'update', callback ); frame.state('replace-image').on( 'replace', callback ); frame.on( 'close', function() { editor.focus(); - // editor.selection.select( img ); - // editor.nodeChanged(); + frame.detach(); }); frame.open(); diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js b/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js index 0233133289..def97d6faf 100644 --- a/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js @@ -73,6 +73,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) { frame.state('gallery-edit').on( 'update', function( selection ) { var shortcode = gallery.shortcode( selection ).string(); editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); + frame.detach(); }); } else if ( editor.dom.hasClass( node, 'wp-playlist' ) && wp.media.playlist ) { data = window.decodeURIComponent( editor.dom.getAttrib( node, 'data-wp-media' ) ); @@ -81,6 +82,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) { frame.state('playlist-edit').on( 'update', function( selection ) { var shortcode = wp.media.playlist.shortcode( selection ).string(); editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); + frame.detach(); }); } else if ( editor.dom.hasClass( node, 'wp-video-playlist' ) && wp.media['video-playlist'] ) { data = window.decodeURIComponent( editor.dom.getAttrib( node, 'data-wp-media' ) ); @@ -89,6 +91,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) { frame.state('video-playlist-edit').on( 'update', function( selection ) { var shortcode = wp.media['video-playlist'].shortcode( selection ).string(); editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); + frame.detach(); }); } else { // temp