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

buddypress-trac noreply at wordpress.org
Wed Jun 10 20:31:31 UTC 2015


#6487: Mentions.js fails on wp-admin post editor
----------------------------------+-----------------------------
 Reporter:  dcavins               |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Component - Activity  |    Version:  2.3.1
 Severity:  normal                |   Keywords:  has-patch
----------------------------------+-----------------------------
 When using the post editor in wp-admin, this error is cropping up:
 `TypeError: null is not an object (evaluating
 'window.tinyMCE.activeEditor.contentDocument') on mentions.js:250`

 Console tells me that  `window.tinyMCE.activeEditor` is null.

 In `mentions.js`, I'm reading the following code:

 {{{
 loadMentionsInTinyMCE = function() {
                         if ( loadAttempts < 4 || ! $( 'body' ).hasClass(
 'wp-admin' ) ) {
                                 loadAttempts++;

                                 if ( typeof window.tinyMCE === 'undefined'
 || window.tinyMCE.activeEditor === null || typeof
 window.tinyMCE.activeEditor === 'undefined' ) {
                                         setTimeout( loadMentionsInTinyMCE,
 500 );
                                         return;
                                 }
                         }

                         $(
 window.tinyMCE.activeEditor.contentDocument.activeElement )
                                 .atwho( 'setIframe', $( '#content_ifr'
 )[0] )
                                 .bp_mentions( users );
                 };
 }}}


 which, if I understand correctly, it will delay the `.atwho.bp_mentions`
 trigger up to five times for half a second each time, but on the sixth
 time, it's gonna roll anyway.

 I'm adding a patch that only runs if the object's property is set, and
 gives up after the five iterations, but I'm unfamiliar with this
 functionality, so I have some doubts that I really understand what's
 happening here.

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


More information about the buddypress-trac mailing list