Ticket #22266: 22266.diff
File 22266.diff, 1.8 KB (added by , 12 years ago) |
---|
-
wp-includes/js/autosave.js
28 28 }); 29 29 30 30 window.onbeforeunload = function(){ 31 var mce = typeof(tinymce) != 'undefined' ? tinymce.activeEditor : false, title, content; 31 var isFullscreen = fullscreen && fullscreen.settings.visible, 32 mce = typeof(tinymce) != 'undefined' ? tinymce.activeEditor : false, 33 title, content, lastContent; 32 34 33 if ( mce && !mce.isHidden() ) { 34 if ( mce.isDirty() ) 35 return autosaveL10n.saveAlert; 35 title = $( isFullscreen ? '#wp-fullscreen-title' : '#title' ).val(); 36 37 // Check if the last autosave had the same title. 38 if ( title && 0 !== autosaveLast.indexOf( title ) ) 39 return autosaveL10n.saveAlert; 40 41 lastContent = autosaveLast.slice( title.length ); 42 43 // If TinyMCE is active, use the editor's content. 44 if ( mce && ! mce.isHidden() ) { 45 content = mce.getContent(); 46 47 // If the TinyMCE editor supports `wpautop`, then normalize the 48 // content by running `pre_wpautop`. 49 if ( mce.getParam('wpautop', true) && switchEditors ) { 50 content = switchEditors.pre_wpautop( content ); 51 lastContent = switchEditors.pre_wpautop( lastContent ); 52 } 36 53 } else { 37 if ( fullscreen && fullscreen.settings.visible ) { 38 title = $('#wp-fullscreen-title').val(); 39 content = $("#wp_mce_fullscreen").val(); 40 } else { 41 title = $('#post #title').val(); 42 content = $('#post #content').val(); 43 } 54 content = $( isFullscreen ? '#wp_mce_fullscreen' : '#content' ).val(); 55 } 44 56 45 if ( ( title || content ) && title + content != autosaveLast ) 46 return autosaveL10n.saveAlert; 47 } 57 if ( content !== lastContent ) 58 return autosaveL10n.saveAlert; 48 59 }; 49 60 50 61 $(window).unload( function(e) {