[wp-trac] [WordPress Trac] #44172: TinyMCE style_formats broken for `a` tags
WordPress Trac
noreply at wordpress.org
Mon May 21 10:59:16 UTC 2018
#44172: TinyMCE style_formats broken for `a` tags
--------------------------+-----------------------------
Reporter: Horttcore | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.9.6
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
It seems that the link inserter breaks the TinyMCE style formats.
P-tag is working, the link-tag not.
{{{#!php
<?php
// Custom styles
add_filter( 'mce_buttons_2', function( $buttons ){
array_unshift( $buttons, 'styleselect' );
return $buttons;
} );
add_filter( 'tiny_mce_before_init', function($init_array){
$style_formats = [
// These are the custom styles
[
'title' => 'Button',
'inline' => 'a',
'classes' => 'btn',
],
[
'title' => 'P',
'block' => 'p',
'classes' => 'largerp',
],
];
// Insert the array, JSON ENCODED, into 'style_formats'
$init_array['style_formats'] = json_encode( $style_formats );
return $init_array;
} );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44172>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list