From 7820525208f21a9702088f0a95683f3f543e63ae Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 10 Sep 2016 11:50:35 -0700 Subject: [PATCH 1/2] Add low-fidelity previewing of page title changes in wp_list_pages() --- js/customize-post-field-partial.js | 6 ++++++ js/customize-preview-posts.js | 2 ++ 2 files changed, 8 insertions(+) diff --git a/js/customize-post-field-partial.js b/js/customize-post-field-partial.js index 9547a8b..2f05e96 100644 --- a/js/customize-post-field-partial.js +++ b/js/customize-post-field-partial.js @@ -71,6 +71,12 @@ } target.text( newPostData.post_title ); } ); + + // Add initial support for previewing title changes in wp_list_pages(). + // @todo Add selective refresh for these. + if ( 'page' === partial.params.post_type ) { + $( '.page_item.page-item-' + partial.params.post_id + ' > a' ).text( newPostData.post_title ); + } } ); } ); } diff --git a/js/customize-preview-posts.js b/js/customize-preview-posts.js index 34f654b..ff28293 100644 --- a/js/customize-preview-posts.js +++ b/js/customize-preview-posts.js @@ -33,6 +33,8 @@ return []; } + // @todo Add partials for wp_list_pages() + // Add the partials. _.each( api.previewPosts.partialSchema( setting.id ), function( schema ) { var partial, addPartial, matches, baseSelector; From 29397b6b7c9e835c765549a3ddfbabd1aef26328 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 20 Sep 2016 23:22:09 -0700 Subject: [PATCH 2/2] Prevent low-fidelity JS preview of page title change in wp_list_pages() affect a nav menu --- js/customize-post-field-partial.js | 2 +- js/customize-preview-posts.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/js/customize-post-field-partial.js b/js/customize-post-field-partial.js index 2f05e96..59a6abd 100644 --- a/js/customize-post-field-partial.js +++ b/js/customize-post-field-partial.js @@ -75,7 +75,7 @@ // Add initial support for previewing title changes in wp_list_pages(). // @todo Add selective refresh for these. if ( 'page' === partial.params.post_type ) { - $( '.page_item.page-item-' + partial.params.post_id + ' > a' ).text( newPostData.post_title ); + $( '.page_item.page-item-' + partial.params.post_id + ':not(.menu-item) > a' ).text( newPostData.post_title ); } } ); } ); diff --git a/js/customize-preview-posts.js b/js/customize-preview-posts.js index ff28293..34f654b 100644 --- a/js/customize-preview-posts.js +++ b/js/customize-preview-posts.js @@ -33,8 +33,6 @@ return []; } - // @todo Add partials for wp_list_pages() - // Add the partials. _.each( api.previewPosts.partialSchema( setting.id ), function( schema ) { var partial, addPartial, matches, baseSelector;