Make WordPress Core


Ignore:
Timestamp:
05/27/2009 11:04:00 AM (17 years ago)
Author:
azaozz
Message:

Ensure autosave is run before showing preview for new posts/pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/post.dev.js

    r11450 r11466  
    211211
    212212jQuery(document).ready( function($) {
    213     var noSyncChecks = false, syncChecks, catAddAfter, dotabkey = true, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
     213    var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
    214214
    215215    // for Press This
     
    476476
    477477    // Custom Fields
    478     jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
     478    $('#the-list').wpList( { addAfter: function( xml, s ) {
    479479        $('table#list-table').show();
    480         if ( jQuery.isFunction( autosave_update_post_ID ) ) {
     480        if ( $.isFunction( autosave_update_post_ID ) ) {
    481481            autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
    482482        }
    483483    }, addBefore: function( s ) {
    484         s.data += '&post_id=' + jQuery('#post_ID').val();
     484        s.data += '&post_id=' + $('#post_ID').val();
    485485        return s;
    486486    }
    487487    });
    488 
    489     // preview
    490     $('#post-preview').click(function(e){
    491         if ( 1 > $('#post_ID').val() && autosaveFirst ) {
    492             autosaveDelayPreview = true;
    493             autosave();
    494             return false;
    495         }
    496 
    497         $('input#wp-preview').val('dopreview');
    498         $('form#post').attr('target', 'wp-preview').submit().attr('target', '');
    499         $('input#wp-preview').val('');
    500         return false;
    501     });
    502 
    503     //  This code is meant to allow tabbing from Title to Post if tinyMCE is defined.
    504     if ( typeof tinyMCE != 'undefined' ) {
    505         $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) {
    506             if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    507                 if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); }
    508                 if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
    509                     e.preventDefault();
    510                     dotabkey = false;
    511                     tinyMCE.activeEditor.focus();
    512                     return false;
    513                 }
    514             }
    515         });
    516     }
    517488});
Note: See TracChangeset for help on using the changeset viewer.