Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #239 from xwp/feature/post-preview-sync-post-slug
Browse files Browse the repository at this point in the history
Add syncing of post_name between edit post screen and customize post preview
  • Loading branch information
westonruter authored Sep 1, 2016
2 parents 6d97df5 + 1820819 commit bf1941a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/edit-post-preview-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var EditPostPreviewAdmin = (function( $ ) {
// Send the current input fields from the edit post page to the Customizer via sessionStorage.
postSettingValue = {
post_title: $( '#title' ).val(),
post_name: $( '#post_name' ).val(),
post_content: editor && ! editor.isHidden() ? wp.editor.removep( editor.getContent() ) : $( '#content' ).val(),
post_excerpt: $( '#excerpt' ).val(),
comment_status: $( '#comment_status' ).prop( 'checked' ) ? 'open' : 'closed',
Expand Down Expand Up @@ -77,6 +78,9 @@ var EditPostPreviewAdmin = (function( $ ) {
$( '#comment_status' ).prop( 'checked', 'open' === data[ postSettingId ].comment_status ).trigger( 'change' );
$( '#ping_status' ).prop( 'checked', 'open' === data[ postSettingId ].ping_status ).trigger( 'change' );
$( '#post_author_override' ).val( data[ postSettingId ].post_author ).trigger( 'change' );
$( '#post_name' ).val( data[ postSettingId ].post_name ).trigger( 'change' );
$( '#new-post-slug' ).val( data[ postSettingId ].post_name );
$( '#editable-post-name, #editable-post-name-full' ).text( data[ postSettingId ].post_name );
}

// Let plugins handle updates.
Expand Down

0 comments on commit bf1941a

Please sign in to comment.