Skip to:
Content
Pages
Categories
Search
Top
Bottom

Visual editor broken when loaded in message pages

  • @gebar

    Participant

    In a multisite install with WordPress 4.0, Buddupress 2.1.1, the twenty-thirteen theme and all plugins disabled, I am adding the WP visual editor to message pages through the following function in the mu-plugins folder:

    function enable_visual_editor_in_buddypress_messages( $editor_text ) {
        ob_start();
        wp_editor( '', 'message_content', array(
    		'textarea_rows' => 15,
    		'teeny' => false,
    		'quicktags' => true,
    		'drag_drop_upload' => false,
    		'media_buttons' => false,
    		'tinymce' => array(
    			'toolbar1'=> 'bold,italic,underline,blockquote,hr,link,unlink,undo,redo,image,emoticons,wp_help',
    			'toolbar2'=> ''
    			),
    		)
    	);
    	$editor_text = ob_get_contents();
    	ob_end_clean();
    	return $editor_text;
    }
    
    add_action( 'bp_before_messages_compose_content', 'enable_visual_editor_in_buddypress_messages' );
    
    add_action( 'bp_before_message_reply_box', 'enable_visual_editor_in_buddypress_messages' );

    The editor loads and it works, but it is missing most of the div wraps and classes of a normal implementation (for instance adding the same function to WP comments).

    After digging around a little, I found out that the editor is not loaded normally through the wp_editor() function in the general-template.php (as happens in the WP comments), but instead BP calls directly the editor_js() function in class-wp-editor.php.

    Another consequence of this is that if you set quicktags to true, the visual tab and functionality disappear completely and you just get a textarea with the quicktags buttons above and no other html markup before and after.

    Any idea why this happens and how can it be amended?

  • The topic ‘Visual editor broken when loaded in message pages’ is closed to new replies.
Skip to toolbar