Ticket #37599: 37599.patch
File 37599.patch, 2.2 KB (added by , 8 years ago) |
---|
-
wp-admin/js/post.js
922 922 })(); 923 923 924 924 if ( typeof tinymce !== 'undefined' ) { 925 925 926 // When changing post formats, change the editor body class 926 927 $( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() { 927 928 var editor, body, format = this.id; … … 933 934 $( document ).trigger( 'editor-classchange' ); 934 935 } 935 936 }); 937 938 // When changing page template, change the editor body class 939 $( '#page_template' ).on( 'change.set-editor-class', function() { 940 var editor, body, pageTemplate = $( this ).val(); 941 942 pageTemplate = pageTemplate.replace( '.php', '' ).substr( pageTemplate.lastIndexOf( '/' ) + 1, pageTemplate.length ); 943 944 if ( pageTemplate && ( editor = tinymce.get( 'content' ) ) ) { 945 body = editor.getBody(); 946 body.className = body.className.replace( /\bpage-template-[^ ]+/, '' ); 947 editor.dom.addClass( body, pageTemplate == 'page-template-0' ? 'page-template-default' : 'page-template-' + pageTemplate ); 948 $( document ).trigger( 'editor-classchange' ); 949 } 950 }); 951 936 952 } 937 953 938 954 // Save on pressing Ctrl/Command + S in the Text editor -
wp-includes/class-wp-editor.php
663 663 $body_class = $editor_id; 664 664 665 665 if ( $post = get_post() ) { 666 666 667 $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status ); 668 667 669 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 668 670 $post_format = get_post_format( $post ); 669 671 if ( $post_format && ! is_wp_error( $post_format ) ) … … 671 673 else 672 674 $body_class .= ' post-format-standard'; 673 675 } 676 677 if ( $page_template = get_page_template_slug( $post ) ) { 678 $body_class .= ' page-template-' . sanitize_html_class( basename( $page_template, '.php' ) ); 679 } 680 674 681 } 675 682 676 683 $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );