DFW: When hiding DFW, switch to correct main editors before saving content. Otherwise, some content will be lost. fixes #17729.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2011-06-08 20:55:33 +00:00
parent 07356cc1a7
commit a0485323c9
3 changed files with 12 additions and 10 deletions

View File

@ -293,7 +293,7 @@ PubSub.prototype.publish = function( topic, args ) {
scrollTo(0, 0); scrollTo(0, 0);
// needed it for IE7 and compat mode // needed it for IE7 and compat mode
$('#wpadminbar').hide(); $('#wpadminbar').hide();
}); });
ps.subscribe( 'shown', function() { // This event occurs after the DFW overlay is shown ps.subscribe( 'shown', function() { // This event occurs after the DFW overlay is shown
@ -320,7 +320,16 @@ PubSub.prototype.publish = function( topic, args ) {
ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW. ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW.
// Make sure the correct editor is displaying.
if ( s.has_tinymce && s.mode === 'tinymce' && $('#' + s.editor_id).is(':visible') ) {
switchEditors.go( s.editor_id, 'tinymce' );
} else if ( s.mode === 'html' && $('#' + s.editor_id).is(':hidden') ) {
switchEditors.go( s.editor_id, 'html' );
}
// Save content must be after switchEditors or content will be overwritten. See #17229.
api.savecontent(); api.savecontent();
$( document ).unbind( '.fullscreen' ); $( document ).unbind( '.fullscreen' );
$(s.textarea_obj).unbind('.grow'); $(s.textarea_obj).unbind('.grow');
@ -336,13 +345,6 @@ PubSub.prototype.publish = function( topic, args ) {
ps.subscribe( 'hiding', function() { // This event occurs while the overlay blocks the DFW UI. ps.subscribe( 'hiding', function() { // This event occurs while the overlay blocks the DFW UI.
// Make sure the correct editor is displaying.
if ( s.has_tinymce && s.mode === 'tinymce' && $('#' + s.editor_id).is(':visible') ) {
switchEditors.go( s.editor_id, 'tinymce' );
} else if ( s.mode == 'html' && $('#' + s.editor_id).is(':hidden') ) {
switchEditors.go( s.editor_id, 'html' );
}
$( document.body ).removeClass( 'fullscreen-active' ); $( document.body ).removeClass( 'fullscreen-active' );
scrollTo(0, s.orig_y); scrollTo(0, s.orig_y);
$('#wpadminbar').show(); $('#wpadminbar').show();

File diff suppressed because one or more lines are too long

View File

@ -96,7 +96,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110411' ); $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110411' );
$scripts->add_data( 'editor', 'group', 1 ); $scripts->add_data( 'editor', 'group', 1 );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110603' ); $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110608' );
$scripts->add_data( 'wp-fullscreen', 'group', 1 ); $scripts->add_data( 'wp-fullscreen', 'group', 1 );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1'); $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');