mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-02 11:21:57 +01:00
Autosave: Properly convert undefined fields to empty strings. This bug could cause issues if a post type didn't support the title and/or editor. see #22491.
git-svn-id: http://core.svn.wordpress.org/trunk@22794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f328a74f77
commit
a962e6f58b
@ -2,7 +2,7 @@ var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', au
|
|||||||
|
|
||||||
jQuery(document).ready( function($) {
|
jQuery(document).ready( function($) {
|
||||||
|
|
||||||
autosaveLast = $('#post #title').val() + $('#post #content').val();
|
autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
|
||||||
autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
|
autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
|
||||||
|
|
||||||
//Disable autosave after the form has been submitted
|
//Disable autosave after the form has been submitted
|
||||||
@ -35,11 +35,11 @@ jQuery(document).ready( function($) {
|
|||||||
return autosaveL10n.saveAlert;
|
return autosaveL10n.saveAlert;
|
||||||
} else {
|
} else {
|
||||||
if ( fullscreen && fullscreen.settings.visible ) {
|
if ( fullscreen && fullscreen.settings.visible ) {
|
||||||
title = $('#wp-fullscreen-title').val();
|
title = $('#wp-fullscreen-title').val() || '';
|
||||||
content = $("#wp_mce_fullscreen").val();
|
content = $("#wp_mce_fullscreen").val() || '';
|
||||||
} else {
|
} else {
|
||||||
title = $('#post #title').val();
|
title = $('#post #title').val() || '';
|
||||||
content = $('#post #content').val();
|
content = $('#post #content').val() || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( title || content ) && title + content != autosaveLast )
|
if ( ( title || content ) && title + content != autosaveLast )
|
||||||
|
Loading…
Reference in New Issue
Block a user