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:
parent
7caa93fd8f
commit
6b6156b5f4
|
@ -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 )
|
||||
|
|
|
@ -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
Binary file not shown.
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue