Skip to:
Content
Pages
Categories
Search
Top
Bottom

Alter mceInit for visual editor on topics


  • CraigM1970
    Participant

    @craigm1970

    Wordpress 3.6.1, bbPress 2.4, Buddypress1.8.1 Site is http://www.thedoctorwhoforum.com

    I’m using the visual TinyMCE editor on my bbPress Forum pages and also on my normal WordPress blog pages.

    Some users have issues with spans and other code being copied in when they paste. I have been able to stop the pasting issue on the blog comments with the following code which added the paste plugin to TinyMCE:

    function myformatTinyMCE($in) {
    	$in['plugins'] = 'inlinepopups, paste, wordpress, wplink, wpdialogs';
    	$in['paste_text_sticky'] = true;
    	$in['paste_text_sticky_default'] = true;
       return $in;
    }
    add_filter('tiny_mce_before_init', 'myformatTinyMCE' );
    

    However, it doesn’t affect TinyMCE on the Forums. They seem to be separate. I instigated the visual editor on the bbPress topics with the following code:

    function bbp_enable_visual_editor($in) {
      $in['tinymce'] = true;
     return $in;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor');

    I’ve tried lots of different things, but I can’t seem to affect the bbPress TinyMCE the same way I can the blog TinyMCE.

    For example, this didn’t work:

    function bbp_enable_visual_editor($in) {
      $in['tinymce'] = true;
      $in['plugins'] = 'inlinepopups, paste, wordpress, wplink, wpdialogs, tabfocus';
      $in['paste_text_sticky'] = true;
      $in['paste_text_sticky_default'] = true;
     return $in;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor');

    Anybody any ideas how to add paste to the plugins and possibly add paste_text_sticky etc as well? I’m a bit new at this.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

  • CraigM1970
    Participant

    @craigm1970

    Okay, I managed to work this out for myself eventually. It was quite simple once I realised I was dealing with the Teeny version. Doh!

    For anyone else who wants to add the Visual editor and also have it only paste plain text from Word etc. here’s how.

    /*  Enable visual editor on tinymce in bbPress  */
    
    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
    
    /* Enable TinyMCE paste plugin */
    
    function bbp_add_paste_plugin($args) {
      array_push($args,'paste');
      return $args;
    }
    add_filter( 'teeny_mce_plugins', 'bbp_add_paste_plugin');
    
    /* Enable paste_sticky as default */
    
    function bbp_myformatTinyMCE($in) {
    	$in['paste_text_sticky'] = true;
    	$in['paste_text_sticky_default'] = true;
       return $in;
    }
    add_filter('teeny_mce_before_init', 'bbp_myformatTinyMCE');
    

    FreeWPress
    Participant

    @freewpress

    Hi, have you a screenshot to view the result with this visual view?

    Thanks…

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.