Changeset 38803
- Timestamp:
- 10/17/2016 01:10:01 AM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/post.js
r38772 r38803 1168 1168 } 1169 1169 }); 1170 1171 // When changing page template, change the editor body class 1172 $( '#page_template' ).on( 'change.set-editor-class', function() { 1173 var editor, body, pageTemplate = $( this ).val() || ''; 1174 1175 pageTemplate = pageTemplate.substr( pageTemplate.lastIndexOf( '/' ) + 1, pageTemplate.length ) 1176 .replace( /\.php$/, '' ) 1177 .replace( /\./g, '-' ); 1178 1179 if ( pageTemplate && ( editor = tinymce.get( 'content' ) ) ) { 1180 body = editor.getBody(); 1181 body.className = body.className.replace( /\bpage-template-[^ ]+/, '' ); 1182 editor.dom.addClass( body, 'page-template-' + pageTemplate ); 1183 $( document ).trigger( 'editor-classchange' ); 1184 } 1185 }); 1186 1170 1187 } 1171 1188 -
trunk/src/wp-includes/class-wp-editor.php
r38773 r38803 664 664 if ( $post = get_post() ) { 665 665 $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status ); 666 666 667 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 667 668 $post_format = get_post_format( $post ); … … 670 671 else 671 672 $body_class .= ' post-format-standard'; 673 } 674 675 if ( $page_template = get_page_template_slug( $post ) ) { 676 $page_template = str_replace( '.', '-', basename( $page_template, '.php' ) ); 677 $body_class .= ' page-template-' . sanitize_html_class( $page_template ); 672 678 } 673 679 }
Note: See TracChangeset
for help on using the changeset viewer.