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

Commit

Permalink
Prevent low-fidelity live preview of post title from running at refresh
Browse files Browse the repository at this point in the history
See #43
  • Loading branch information
westonruter committed Jul 29, 2016
1 parent f382ef9 commit faf80fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/customize-post-field-partial.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@
// Post title.
if ( 'post_title' === partial.params.field_id ) {
api( settingId, function( setting ) {
setting.bind( function( postData ) {
if ( ! postData || ! _.isString( postData.post_title ) ) {
setting.bind( function( newPostData, oldPostData ) {
if ( ! newPostData || oldPostData && newPostData.post_title === oldPostData.post_title ) {
return;
}
_.each( partial.placements(), function( placement ) {
var target = placement.container.find( '> a' );
if ( ! target.length ) {
target = placement.container;
}
target.text( postData.post_title );
target.text( newPostData.post_title );
} );
} );
} );
Expand Down

0 comments on commit faf80fa

Please sign in to comment.