wp/wp-admin/js/widgets/text-widgets.js
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   289 					throw new Error( 'Failed to initialize editor' );
   289 					throw new Error( 'Failed to initialize editor' );
   290 				}
   290 				}
   291 				onInit = function() {
   291 				onInit = function() {
   292 
   292 
   293 					// When a widget is moved in the DOM the dynamically-created TinyMCE iframe will be destroyed and has to be re-built.
   293 					// When a widget is moved in the DOM the dynamically-created TinyMCE iframe will be destroyed and has to be re-built.
   294 					$( editor.getWin() ).on( 'unload', function() {
   294 					$( editor.getWin() ).on( 'pagehide', function() {
   295 						_.defer( buildEditor );
   295 						_.defer( buildEditor );
   296 					});
   296 					});
   297 
   297 
   298 					// If a prior mce instance was replaced, and it was in text mode, toggle to text mode.
   298 					// If a prior mce instance was replaced, and it was in text mode, toggle to text mode.
   299 					if ( restoreTextMode ) {
   299 					if ( restoreTextMode ) {