Edit File by line
/home/zeestwma/ceyloniy.../wp-admin/js
File: inline-edit-post.js
/**
[0] Fix | Delete
* This file contains the functions needed for the inline editing of posts.
[1] Fix | Delete
*
[2] Fix | Delete
* @since 2.7.0
[3] Fix | Delete
* @output wp-admin/js/inline-edit-post.js
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/* global ajaxurl, typenow, inlineEditPost */
[7] Fix | Delete
[8] Fix | Delete
window.wp = window.wp || {};
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Manages the quick edit and bulk edit windows for editing posts or pages.
[12] Fix | Delete
*
[13] Fix | Delete
* @namespace inlineEditPost
[14] Fix | Delete
*
[15] Fix | Delete
* @since 2.7.0
[16] Fix | Delete
*
[17] Fix | Delete
* @type {Object}
[18] Fix | Delete
*
[19] Fix | Delete
* @property {string} type The type of inline editor.
[20] Fix | Delete
* @property {string} what The prefix before the post ID.
[21] Fix | Delete
*
[22] Fix | Delete
*/
[23] Fix | Delete
( function( $, wp ) {
[24] Fix | Delete
[25] Fix | Delete
window.inlineEditPost = {
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Initializes the inline and bulk post editor.
[29] Fix | Delete
*
[30] Fix | Delete
* Binds event handlers to the Escape key to close the inline editor
[31] Fix | Delete
* and to the save and close buttons. Changes DOM to be ready for inline
[32] Fix | Delete
* editing. Adds event handler to bulk edit.
[33] Fix | Delete
*
[34] Fix | Delete
* @since 2.7.0
[35] Fix | Delete
*
[36] Fix | Delete
* @memberof inlineEditPost
[37] Fix | Delete
*
[38] Fix | Delete
* @return {void}
[39] Fix | Delete
*/
[40] Fix | Delete
init : function(){
[41] Fix | Delete
var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
[42] Fix | Delete
[43] Fix | Delete
t.type = $('table.widefat').hasClass('pages') ? 'page' : 'post';
[44] Fix | Delete
// Post ID prefix.
[45] Fix | Delete
t.what = '#post-';
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Binds the Escape key to revert the changes and close the quick editor.
[49] Fix | Delete
*
[50] Fix | Delete
* @return {boolean} The result of revert.
[51] Fix | Delete
*/
[52] Fix | Delete
qeRow.on( 'keyup', function(e){
[53] Fix | Delete
// Revert changes if Escape key is pressed.
[54] Fix | Delete
if ( e.which === 27 ) {
[55] Fix | Delete
return inlineEditPost.revert();
[56] Fix | Delete
}
[57] Fix | Delete
});
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Binds the Escape key to revert the changes and close the bulk editor.
[61] Fix | Delete
*
[62] Fix | Delete
* @return {boolean} The result of revert.
[63] Fix | Delete
*/
[64] Fix | Delete
bulkRow.on( 'keyup', function(e){
[65] Fix | Delete
// Revert changes if Escape key is pressed.
[66] Fix | Delete
if ( e.which === 27 ) {
[67] Fix | Delete
return inlineEditPost.revert();
[68] Fix | Delete
}
[69] Fix | Delete
});
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Reverts changes and close the quick editor if the cancel button is clicked.
[73] Fix | Delete
*
[74] Fix | Delete
* @return {boolean} The result of revert.
[75] Fix | Delete
*/
[76] Fix | Delete
$( '.cancel', qeRow ).on( 'click', function() {
[77] Fix | Delete
return inlineEditPost.revert();
[78] Fix | Delete
});
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Saves changes in the quick editor if the save(named: update) button is clicked.
[82] Fix | Delete
*
[83] Fix | Delete
* @return {boolean} The result of save.
[84] Fix | Delete
*/
[85] Fix | Delete
$( '.save', qeRow ).on( 'click', function() {
[86] Fix | Delete
return inlineEditPost.save(this);
[87] Fix | Delete
});
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* If Enter is pressed, and the target is not the cancel button, save the post.
[91] Fix | Delete
*
[92] Fix | Delete
* @return {boolean} The result of save.
[93] Fix | Delete
*/
[94] Fix | Delete
$('td', qeRow).on( 'keydown', function(e){
[95] Fix | Delete
if ( e.which === 13 && ! $( e.target ).hasClass( 'cancel' ) ) {
[96] Fix | Delete
return inlineEditPost.save(this);
[97] Fix | Delete
}
[98] Fix | Delete
});
[99] Fix | Delete
[100] Fix | Delete
/**
[101] Fix | Delete
* Reverts changes and close the bulk editor if the cancel button is clicked.
[102] Fix | Delete
*
[103] Fix | Delete
* @return {boolean} The result of revert.
[104] Fix | Delete
*/
[105] Fix | Delete
$( '.cancel', bulkRow ).on( 'click', function() {
[106] Fix | Delete
return inlineEditPost.revert();
[107] Fix | Delete
});
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Disables the password input field when the private post checkbox is checked.
[111] Fix | Delete
*/
[112] Fix | Delete
$('#inline-edit .inline-edit-private input[value="private"]').on( 'click', function(){
[113] Fix | Delete
var pw = $('input.inline-edit-password-input');
[114] Fix | Delete
if ( $(this).prop('checked') ) {
[115] Fix | Delete
pw.val('').prop('disabled', true);
[116] Fix | Delete
} else {
[117] Fix | Delete
pw.prop('disabled', false);
[118] Fix | Delete
}
[119] Fix | Delete
});
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Binds click event to the .editinline button which opens the quick editor.
[123] Fix | Delete
*/
[124] Fix | Delete
$( '#the-list' ).on( 'click', '.editinline', function() {
[125] Fix | Delete
$( this ).attr( 'aria-expanded', 'true' );
[126] Fix | Delete
inlineEditPost.edit( this );
[127] Fix | Delete
});
[128] Fix | Delete
[129] Fix | Delete
// Clone quick edit categories for the bulk editor.
[130] Fix | Delete
var beCategories = $( '#inline-edit fieldset.inline-edit-categories' ).clone();
[131] Fix | Delete
[132] Fix | Delete
// Make "id" attributes globally unique.
[133] Fix | Delete
beCategories.find( '*[id]' ).each( function() {
[134] Fix | Delete
this.id = 'bulk-edit-' + this.id;
[135] Fix | Delete
});
[136] Fix | Delete
[137] Fix | Delete
$('#bulk-edit').find('fieldset:first').after(
[138] Fix | Delete
beCategories
[139] Fix | Delete
).siblings( 'fieldset:last' ).prepend(
[140] Fix | Delete
$( '#inline-edit .inline-edit-tags-wrap' ).clone()
[141] Fix | Delete
);
[142] Fix | Delete
[143] Fix | Delete
$('select[name="_status"] option[value="future"]', bulkRow).remove();
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Adds onclick events to the apply buttons.
[147] Fix | Delete
*/
[148] Fix | Delete
$('#doaction').on( 'click', function(e){
[149] Fix | Delete
var n,
[150] Fix | Delete
$itemsSelected = $( '#posts-filter .check-column input[type="checkbox"]:checked' );
[151] Fix | Delete
[152] Fix | Delete
if ( $itemsSelected.length < 1 ) {
[153] Fix | Delete
return;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
t.whichBulkButtonId = $( this ).attr( 'id' );
[157] Fix | Delete
n = t.whichBulkButtonId.substr( 2 );
[158] Fix | Delete
[159] Fix | Delete
if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
[160] Fix | Delete
e.preventDefault();
[161] Fix | Delete
t.setBulk();
[162] Fix | Delete
} else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
[163] Fix | Delete
t.revert();
[164] Fix | Delete
}
[165] Fix | Delete
});
[166] Fix | Delete
},
[167] Fix | Delete
[168] Fix | Delete
/**
[169] Fix | Delete
* Toggles the quick edit window, hiding it when it's active and showing it when
[170] Fix | Delete
* inactive.
[171] Fix | Delete
*
[172] Fix | Delete
* @since 2.7.0
[173] Fix | Delete
*
[174] Fix | Delete
* @memberof inlineEditPost
[175] Fix | Delete
*
[176] Fix | Delete
* @param {Object} el Element within a post table row.
[177] Fix | Delete
*/
[178] Fix | Delete
toggle : function(el){
[179] Fix | Delete
var t = this;
[180] Fix | Delete
$( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el );
[181] Fix | Delete
},
[182] Fix | Delete
[183] Fix | Delete
/**
[184] Fix | Delete
* Creates the bulk editor row to edit multiple posts at once.
[185] Fix | Delete
*
[186] Fix | Delete
* @since 2.7.0
[187] Fix | Delete
*
[188] Fix | Delete
* @memberof inlineEditPost
[189] Fix | Delete
*/
[190] Fix | Delete
setBulk : function(){
[191] Fix | Delete
var te = '', type = this.type, c = true;
[192] Fix | Delete
var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' );
[193] Fix | Delete
var categories = {};
[194] Fix | Delete
this.revert();
[195] Fix | Delete
[196] Fix | Delete
$( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
[197] Fix | Delete
[198] Fix | Delete
// Insert the editor at the top of the table with an empty row above to maintain zebra striping.
[199] Fix | Delete
$('table.widefat tbody').prepend( $('#bulk-edit') ).prepend('<tr class="hidden"></tr>');
[200] Fix | Delete
$('#bulk-edit').addClass('inline-editor').show();
[201] Fix | Delete
[202] Fix | Delete
/**
[203] Fix | Delete
* Create a HTML div with the title and a link(delete-icon) for each selected
[204] Fix | Delete
* post.
[205] Fix | Delete
*
[206] Fix | Delete
* Get the selected posts based on the checked checkboxes in the post table.
[207] Fix | Delete
*/
[208] Fix | Delete
$( 'tbody th.check-column input[type="checkbox"]' ).each( function() {
[209] Fix | Delete
[210] Fix | Delete
// If the checkbox for a post is selected, add the post to the edit list.
[211] Fix | Delete
if ( $(this).prop('checked') ) {
[212] Fix | Delete
c = false;
[213] Fix | Delete
var id = $( this ).val(),
[214] Fix | Delete
theTitle = $( '#inline_' + id + ' .post_title' ).html() || wp.i18n.__( '(no title)' ),
[215] Fix | Delete
buttonVisuallyHiddenText = wp.i18n.sprintf(
[216] Fix | Delete
/* translators: %s: Post title. */
[217] Fix | Delete
wp.i18n.__( 'Remove &#8220;%s&#8221; from Bulk Edit' ),
[218] Fix | Delete
theTitle
[219] Fix | Delete
);
[220] Fix | Delete
[221] Fix | Delete
te += '<li class="ntdelitem"><button type="button" id="_' + id + '" class="button-link ntdelbutton"><span class="screen-reader-text">' + buttonVisuallyHiddenText + '</span></button><span class="ntdeltitle" aria-hidden="true">' + theTitle + '</span></li>';
[222] Fix | Delete
}
[223] Fix | Delete
});
[224] Fix | Delete
[225] Fix | Delete
// If no checkboxes where checked, just hide the quick/bulk edit rows.
[226] Fix | Delete
if ( c ) {
[227] Fix | Delete
return this.revert();
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
// Populate the list of items to bulk edit.
[231] Fix | Delete
$( '#bulk-titles' ).html( '<ul id="bulk-titles-list" role="list">' + te + '</ul>' );
[232] Fix | Delete
[233] Fix | Delete
// Gather up some statistics on which of these checked posts are in which categories.
[234] Fix | Delete
checkedPosts.each( function() {
[235] Fix | Delete
var id = $( this ).val();
[236] Fix | Delete
var checked = $( '#category_' + id ).text().split( ',' );
[237] Fix | Delete
[238] Fix | Delete
checked.map( function( cid ) {
[239] Fix | Delete
categories[ cid ] || ( categories[ cid ] = 0 );
[240] Fix | Delete
// Just record that this category is checked.
[241] Fix | Delete
categories[ cid ]++;
[242] Fix | Delete
} );
[243] Fix | Delete
} );
[244] Fix | Delete
[245] Fix | Delete
// Compute initial states.
[246] Fix | Delete
$( '.inline-edit-categories input[name="post_category[]"]' ).each( function() {
[247] Fix | Delete
if ( categories[ $( this ).val() ] == checkedPosts.length ) {
[248] Fix | Delete
// If the number of checked categories matches the number of selected posts, then all posts are in this category.
[249] Fix | Delete
$( this ).prop( 'checked', true );
[250] Fix | Delete
} else if ( categories[ $( this ).val() ] > 0 ) {
[251] Fix | Delete
// If the number is less than the number of selected posts, then it's indeterminate.
[252] Fix | Delete
$( this ).prop( 'indeterminate', true );
[253] Fix | Delete
if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) {
[254] Fix | Delete
// Get the term label text.
[255] Fix | Delete
var label = $( this ).parent().text();
[256] Fix | Delete
// Set indeterminate states for the backend. Add accessible text for indeterminate inputs.
[257] Fix | Delete
$( this ).after( '<input type="hidden" name="indeterminate_post_category[]" value="' + $( this ).val() + '">' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) );
[258] Fix | Delete
}
[259] Fix | Delete
}
[260] Fix | Delete
} );
[261] Fix | Delete
[262] Fix | Delete
$( '.inline-edit-categories input[name="post_category[]"]:indeterminate' ).on( 'change', function() {
[263] Fix | Delete
// Remove accessible label text. Remove the indeterminate flags as there was a specific state change.
[264] Fix | Delete
$( this ).removeAttr( 'aria-label' ).parent().find( 'input[name="indeterminate_post_category[]"]' ).remove();
[265] Fix | Delete
} );
[266] Fix | Delete
[267] Fix | Delete
$( '.inline-edit-save button' ).on( 'click', function() {
[268] Fix | Delete
$( '.inline-edit-categories input[name="post_category[]"]' ).prop( 'indeterminate', false );
[269] Fix | Delete
} );
[270] Fix | Delete
[271] Fix | Delete
/**
[272] Fix | Delete
* Binds on click events to handle the list of items to bulk edit.
[273] Fix | Delete
*
[274] Fix | Delete
* @listens click
[275] Fix | Delete
*/
[276] Fix | Delete
$( '#bulk-titles .ntdelbutton' ).click( function() {
[277] Fix | Delete
var $this = $( this ),
[278] Fix | Delete
id = $this.attr( 'id' ).substr( 1 ),
[279] Fix | Delete
$prev = $this.parent().prev().children( '.ntdelbutton' ),
[280] Fix | Delete
$next = $this.parent().next().children( '.ntdelbutton' );
[281] Fix | Delete
[282] Fix | Delete
$( 'input#cb-select-all-1, input#cb-select-all-2' ).prop( 'checked', false );
[283] Fix | Delete
$( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
[284] Fix | Delete
$( '#_' + id ).parent().remove();
[285] Fix | Delete
wp.a11y.speak( wp.i18n.__( 'Item removed.' ), 'assertive' );
[286] Fix | Delete
[287] Fix | Delete
// Move focus to a proper place when items are removed.
[288] Fix | Delete
if ( $next.length ) {
[289] Fix | Delete
$next.focus();
[290] Fix | Delete
} else if ( $prev.length ) {
[291] Fix | Delete
$prev.focus();
[292] Fix | Delete
} else {
[293] Fix | Delete
$( '#bulk-titles-list' ).remove();
[294] Fix | Delete
inlineEditPost.revert();
[295] Fix | Delete
wp.a11y.speak( wp.i18n.__( 'All selected items have been removed. Select new items to use Bulk Actions.' ) );
[296] Fix | Delete
}
[297] Fix | Delete
});
[298] Fix | Delete
[299] Fix | Delete
// Enable auto-complete for tags when editing posts.
[300] Fix | Delete
if ( 'post' === type ) {
[301] Fix | Delete
$( 'tr.inline-editor textarea[data-wp-taxonomy]' ).each( function ( i, element ) {
[302] Fix | Delete
/*
[303] Fix | Delete
* While Quick Edit clones the form each time, Bulk Edit always re-uses
[304] Fix | Delete
* the same form. Let's check if an autocomplete instance already exists.
[305] Fix | Delete
*/
[306] Fix | Delete
if ( $( element ).autocomplete( 'instance' ) ) {
[307] Fix | Delete
// jQuery equivalent of `continue` within an `each()` loop.
[308] Fix | Delete
return;
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
$( element ).wpTagsSuggest();
[312] Fix | Delete
} );
[313] Fix | Delete
}
[314] Fix | Delete
[315] Fix | Delete
// Set initial focus on the Bulk Edit region.
[316] Fix | Delete
$( '#bulk-edit .inline-edit-wrapper' ).attr( 'tabindex', '-1' ).focus();
[317] Fix | Delete
// Scrolls to the top of the table where the editor is rendered.
[318] Fix | Delete
$('html, body').animate( { scrollTop: 0 }, 'fast' );
[319] Fix | Delete
},
[320] Fix | Delete
[321] Fix | Delete
/**
[322] Fix | Delete
* Creates a quick edit window for the post that has been clicked.
[323] Fix | Delete
*
[324] Fix | Delete
* @since 2.7.0
[325] Fix | Delete
*
[326] Fix | Delete
* @memberof inlineEditPost
[327] Fix | Delete
*
[328] Fix | Delete
* @param {number|Object} id The ID of the clicked post or an element within a post
[329] Fix | Delete
* table row.
[330] Fix | Delete
* @return {boolean} Always returns false at the end of execution.
[331] Fix | Delete
*/
[332] Fix | Delete
edit : function(id) {
[333] Fix | Delete
var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, f, val, pw;
[334] Fix | Delete
t.revert();
[335] Fix | Delete
[336] Fix | Delete
if ( typeof(id) === 'object' ) {
[337] Fix | Delete
id = t.getId(id);
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order', 'page_template'];
[341] Fix | Delete
if ( t.type === 'page' ) {
[342] Fix | Delete
fields.push('post_parent');
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
// Add the new edit row with an extra blank row underneath to maintain zebra striping.
[346] Fix | Delete
editRow = $('#inline-edit').clone(true);
[347] Fix | Delete
$( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
[348] Fix | Delete
[349] Fix | Delete
// Remove the ID from the copied row and let the `for` attribute reference the hidden ID.
[350] Fix | Delete
$( 'td', editRow ).find('#quick-edit-legend').removeAttr('id');
[351] Fix | Delete
$( 'td', editRow ).find('p[id^="quick-edit-"]').removeAttr('id');
[352] Fix | Delete
[353] Fix | Delete
$(t.what+id).removeClass('is-expanded').hide().after(editRow).after('<tr class="hidden"></tr>');
[354] Fix | Delete
[355] Fix | Delete
// Populate fields in the quick edit window.
[356] Fix | Delete
rowData = $('#inline_'+id);
[357] Fix | Delete
if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) {
[358] Fix | Delete
[359] Fix | Delete
// The post author no longer has edit capabilities, so we need to add them to the list of authors.
[360] Fix | Delete
$(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#post-' + id + ' .author').text() + '</option>');
[361] Fix | Delete
}
[362] Fix | Delete
if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
[363] Fix | Delete
$('label.inline-edit-author', editRow).hide();
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
for ( f = 0; f < fields.length; f++ ) {
[367] Fix | Delete
val = $('.'+fields[f], rowData);
[368] Fix | Delete
[369] Fix | Delete
/**
[370] Fix | Delete
* Replaces the image for a Twemoji(Twitter emoji) with it's alternate text.
[371] Fix | Delete
*
[372] Fix | Delete
* @return {string} Alternate text from the image.
[373] Fix | Delete
*/
[374] Fix | Delete
val.find( 'img' ).replaceWith( function() { return this.alt; } );
[375] Fix | Delete
val = val.text();
[376] Fix | Delete
$(':input[name="' + fields[f] + '"]', editRow).val( val );
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
if ( $( '.comment_status', rowData ).text() === 'open' ) {
[380] Fix | Delete
$( 'input[name="comment_status"]', editRow ).prop( 'checked', true );
[381] Fix | Delete
}
[382] Fix | Delete
if ( $( '.ping_status', rowData ).text() === 'open' ) {
[383] Fix | Delete
$( 'input[name="ping_status"]', editRow ).prop( 'checked', true );
[384] Fix | Delete
}
[385] Fix | Delete
if ( $( '.sticky', rowData ).text() === 'sticky' ) {
[386] Fix | Delete
$( 'input[name="sticky"]', editRow ).prop( 'checked', true );
[387] Fix | Delete
}
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Creates the select boxes for the categories.
[391] Fix | Delete
*/
[392] Fix | Delete
$('.post_category', rowData).each(function(){
[393] Fix | Delete
var taxname,
[394] Fix | Delete
term_ids = $(this).text();
[395] Fix | Delete
[396] Fix | Delete
if ( term_ids ) {
[397] Fix | Delete
taxname = $(this).attr('id').replace('_'+id, '');
[398] Fix | Delete
$('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
[399] Fix | Delete
}
[400] Fix | Delete
});
[401] Fix | Delete
[402] Fix | Delete
/**
[403] Fix | Delete
* Gets all the taxonomies for live auto-fill suggestions when typing the name
[404] Fix | Delete
* of a tag.
[405] Fix | Delete
*/
[406] Fix | Delete
$('.tags_input', rowData).each(function(){
[407] Fix | Delete
var terms = $(this),
[408] Fix | Delete
taxname = $(this).attr('id').replace('_' + id, ''),
[409] Fix | Delete
textarea = $('textarea.tax_input_' + taxname, editRow),
[410] Fix | Delete
comma = wp.i18n._x( ',', 'tag delimiter' ).trim();
[411] Fix | Delete
[412] Fix | Delete
// Ensure the textarea exists.
[413] Fix | Delete
if ( ! textarea.length ) {
[414] Fix | Delete
return;
[415] Fix | Delete
}
[416] Fix | Delete
[417] Fix | Delete
terms.find( 'img' ).replaceWith( function() { return this.alt; } );
[418] Fix | Delete
terms = terms.text();
[419] Fix | Delete
[420] Fix | Delete
if ( terms ) {
[421] Fix | Delete
if ( ',' !== comma ) {
[422] Fix | Delete
terms = terms.replace(/,/g, comma);
[423] Fix | Delete
}
[424] Fix | Delete
textarea.val(terms);
[425] Fix | Delete
}
[426] Fix | Delete
[427] Fix | Delete
textarea.wpTagsSuggest();
[428] Fix | Delete
});
[429] Fix | Delete
[430] Fix | Delete
// Handle the post status.
[431] Fix | Delete
var post_date_string = $(':input[name="aa"]').val() + '-' + $(':input[name="mm"]').val() + '-' + $(':input[name="jj"]').val();
[432] Fix | Delete
post_date_string += ' ' + $(':input[name="hh"]').val() + ':' + $(':input[name="mn"]').val() + ':' + $(':input[name="ss"]').val();
[433] Fix | Delete
var post_date = new Date( post_date_string );
[434] Fix | Delete
status = $('._status', rowData).text();
[435] Fix | Delete
if ( 'future' !== status && Date.now() > post_date ) {
[436] Fix | Delete
$('select[name="_status"] option[value="future"]', editRow).remove();
[437] Fix | Delete
} else {
[438] Fix | Delete
$('select[name="_status"] option[value="publish"]', editRow).remove();
[439] Fix | Delete
}
[440] Fix | Delete
[441] Fix | Delete
pw = $( '.inline-edit-password-input' ).prop( 'disabled', false );
[442] Fix | Delete
if ( 'private' === status ) {
[443] Fix | Delete
$('input[name="keep_private"]', editRow).prop('checked', true);
[444] Fix | Delete
pw.val( '' ).prop( 'disabled', true );
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
// Remove the current page and children from the parent dropdown.
[448] Fix | Delete
pageOpt = $('select[name="post_parent"] option[value="' + id + '"]', editRow);
[449] Fix | Delete
if ( pageOpt.length > 0 ) {
[450] Fix | Delete
pageLevel = pageOpt[0].className.split('-')[1];
[451] Fix | Delete
nextPage = pageOpt;
[452] Fix | Delete
while ( pageLoop ) {
[453] Fix | Delete
nextPage = nextPage.next('option');
[454] Fix | Delete
if ( nextPage.length === 0 ) {
[455] Fix | Delete
break;
[456] Fix | Delete
}
[457] Fix | Delete
[458] Fix | Delete
nextLevel = nextPage[0].className.split('-')[1];
[459] Fix | Delete
[460] Fix | Delete
if ( nextLevel <= pageLevel ) {
[461] Fix | Delete
pageLoop = false;
[462] Fix | Delete
} else {
[463] Fix | Delete
nextPage.remove();
[464] Fix | Delete
nextPage = pageOpt;
[465] Fix | Delete
}
[466] Fix | Delete
}
[467] Fix | Delete
pageOpt.remove();
[468] Fix | Delete
}
[469] Fix | Delete
[470] Fix | Delete
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
[471] Fix | Delete
$('.ptitle', editRow).trigger( 'focus' );
[472] Fix | Delete
[473] Fix | Delete
return false;
[474] Fix | Delete
},
[475] Fix | Delete
[476] Fix | Delete
/**
[477] Fix | Delete
* Saves the changes made in the quick edit window to the post.
[478] Fix | Delete
* Ajax saving is only for Quick Edit and not for bulk edit.
[479] Fix | Delete
*
[480] Fix | Delete
* @since 2.7.0
[481] Fix | Delete
*
[482] Fix | Delete
* @param {number} id The ID for the post that has been changed.
[483] Fix | Delete
* @return {boolean} False, so the form does not submit when pressing
[484] Fix | Delete
* Enter on a focused field.
[485] Fix | Delete
*/
[486] Fix | Delete
save : function(id) {
[487] Fix | Delete
var params, fields, page = $('.post_status_page').val() || '';
[488] Fix | Delete
[489] Fix | Delete
if ( typeof(id) === 'object' ) {
[490] Fix | Delete
id = this.getId(id);
[491] Fix | Delete
}
[492] Fix | Delete
[493] Fix | Delete
$( 'table.widefat .spinner' ).addClass( 'is-active' );
[494] Fix | Delete
[495] Fix | Delete
params = {
[496] Fix | Delete
action: 'inline-save',
[497] Fix | Delete
post_type: typenow,
[498] Fix | Delete
post_ID: id,
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function