nbsp Removed when pasting and posting
-
Hello! Hope you can help me here with this, I have been already struggling quite a long time.
My main problem is that, using your visual editor, my customers are not able to paste their lines of code keeping the original indentation . For some reason tinyMCE removes nbsp, the non-breaking space entity .
First of all I am using this plugin mainly to provide my customers a visual editor in our BBPress Forum.
I needed to configure my tinyMCE to be able to include a custom button that I created to paste code. Additionally, I realized that this tinyMCE didn’t keep properly the format of the posts after pressing the “edit button”, so I made the folling configuration:
/* * my_format_TinyMCE * * Enable custom CSS for tinyMCE * */ function my_format_TinyMCE( $in ) { $in['content_css'] = home_url() . "/wp-content/themes/tisson-child/tinyMCE-editor-style.css"; return $in; } add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' ); /* * bbp_enable_visual_editor * * Enable plugins for tinyMCE and custom settings */ function bbp_enable_visual_editor( $args = array() ) { $args['tinymce'] = true; // $args['quicktags'] = false; $args['teeny'] = false; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' ); /* * Creating Custom CODE button for tinyMCE * * It will insert back-quotes that bbpress and crayon-highlighter will * understand as code */ add_action( 'init', 'wptuts_buttons' ); function wptuts_buttons() { add_filter( "mce_external_plugins", "wptuts_add_buttons" ); add_filter( 'mce_buttons', 'wptuts_register_buttons' ); } function wptuts_add_buttons( $plugin_array ) { $plugin_array['wptuts'] = home_url() . '/wp-content/themes/tisson-child/wptuts-editor-buttons/wptuts-plugin.js'; return $plugin_array; } function wptuts_register_buttons( $buttons ) { array_push( $buttons, 'dropcap', 'showrecent' ); // dropcap', 'recentposts return $buttons; }My custom button just adds back quotes to the selected text to format it afterwards, nothing interfering with my plugin.
I figured out that removing the line
$args['teeny'] = false;from my above code fixes this problem, but then I am facing a tinyMCE that breaks after pressing edit post and that doesn’t allow me to add custom buttons.Any idea here? 🙂
The topic ‘ nbsp Removed when pasting and posting’ is closed to new replies.