[buddypress-trac] [BuddyPress Trac] #6487: Mentions.js fails on wp-admin post editor

buddypress-trac noreply at wordpress.org
Mon Jul 13 19:47:26 UTC 2015


#6487: Mentions.js fails on wp-admin post editor
----------------------------------+--------------------
 Reporter:  dcavins               |       Owner:
     Type:  defect (bug)          |      Status:  new
 Priority:  normal                |   Milestone:  2.3.3
Component:  Component - Activity  |     Version:  2.3.1
 Severity:  normal                |  Resolution:
 Keywords:  has-patch             |
----------------------------------+--------------------

Comment (by dcavins):

 With my proposed fix, here’s the behavior I’m seeing. If you load the post
 edit page with the “visual” editor preselected, then `bp_mentions` gets
 attached to the `wp_editor` iframe as expected. If you switch to the text
 editor, `bp_mentions` is attached there as well. If the page loads with
 the text pane visible, `bp_mentions` is attached to the text editor as
 expected, but `loadMentionsInTinyMCE` uses up its tries and gives up
 trying to attach the iframe, and when you switch to the visual editor,
 `bp_mentions` doesn’t work.

 Maybe the better bet would be to attach to the `wp_editor` iframe when
 it's loaded (from @boone: [http://teleogistic.net/2012/02/09/using-init-
 callbacks-with-tinymce-and-wp_editor-in-wordpress/]).

 By adding this action:
 {{{
 function bp_add_mentions_on_tiny_mce_init( $initArray ) {
   $initArray['setup'] = 'function(ed) {
         ed.onInit.add(
           function(ed) {
             loadMentionsInTinyMCE();
             });
     }';

   return $initArray;
 }
 add_filter( 'tiny_mce_before_init', 'bp_add_mentions_on_tiny_mce_init' );
 }}}

 to a functions file, and using the attached modified `mentions.js`,
 `loadMentionsInTinyMCE()` is fired when the editor is loaded. This might
 be worth looking into?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6487#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list