Add the editor ID and the post type (when available) as classes to the TinyMCE's body, fixes #19437

git-svn-id: http://svn.automattic.com/wordpress/trunk@19912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2012-02-13 07:22:45 +00:00
parent 7caa93fd8f
commit 6b6156b5f4
5 changed files with 20 additions and 4 deletions

View File

@ -124,7 +124,7 @@ final class _WP_Editors {
}
public static function editor_settings($editor_id, $set) {
global $editor_styles;
global $editor_styles, $post;
$first_run = false;
if ( empty(self::$first_init) ) {
@ -369,6 +369,16 @@ final class _WP_Editors {
$mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id);
}
$body_class = $editor_id;
if ( isset($post) )
$body_class .= " post-type-$post->post_type";
if ( !empty($set['tinymce']['body_class']) ) {
$body_class .= ' ' . $set['tinymce']['body_class'];
unset($set['tinymce']['body_class']);
}
if ( $set['dfw'] ) {
// replace the first 'fullscreen' with 'wp_fullscreen'
if ( ($key = array_search('fullscreen', $mce_buttons)) !== false )
@ -389,7 +399,8 @@ final class _WP_Editors {
'theme_advanced_buttons1' => implode($mce_buttons, ','),
'theme_advanced_buttons2' => implode($mce_buttons_2, ','),
'theme_advanced_buttons3' => implode($mce_buttons_3, ','),
'theme_advanced_buttons4' => implode($mce_buttons_4, ',')
'theme_advanced_buttons4' => implode($mce_buttons_4, ','),
'body_class' => $body_class
);
if ( $first_run )

View File

@ -146,6 +146,8 @@
});
ed.onInit.add(function(ed) {
var bodyClass = ed.getParam('body_class', '');
// make sure these run last
ed.onNodeChange.add( function(ed, cm, e) {
var DL;
@ -181,6 +183,9 @@
o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
}
});
if ( bodyClass )
ed.dom.addClass(ed.getBody(), bodyClass);
});
// Word count

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ $wp_db_version = 19863;
*
* @global string $tinymce_version
*/
$tinymce_version = '348-20120204';
$tinymce_version = '348-20120212';
/**
* Holds the cache manifest version