Skip to:
Content

BuddyPress.org

Changeset 9100


Ignore:
Timestamp:
10/29/2014 12:36:18 AM (10 years ago)
Author:
djpaul
Message:

Mentions: load in the dashboard's Visual editor.

Inspired by Automattic's O2 team's implementation of the At.js library
inside publishing screens.

Also updated RTL CSS missed from a previous commit.

Fixes #5969

Location:
trunk/src/bp-activity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/css/mentions-rtl.css

    r9008 r9100  
    11.atwho-view {
    2     background: #FFF;
     2    background: rgba(204, 204, 204, 0.8);
    33    border-radius: 2px;
    44    border: 1px solid rgb(204, 204, 204);
     
    1717}
    1818.atwho-view ul {
     19    background: #FFF;
    1920    list-style: none;
    2021    margin: auto;
     
    6364        margin: 0 0 0 10px;
    6465    }
    65     .atwho-view small {
    66         display: none;
    67     }
    6866}
    6967@media (max-width: 400px) {
     
    7876        width: 30px;
    7977    }
     78    .atwho-view {
     79        border-radius: 0;
     80        height: 100%;
     81        right: 0 !important;
     82        width: 100%;
     83    }
     84    .atwho-view ul li .username {
     85        display: inline-block;
     86        margin: -10px 0 0 0;
     87        padding: 10px 0;
     88    }
     89    .atwho-view ul li small {
     90        display: inline-block;
     91        margin-right: 20px;
     92    }
    8093}
  • trunk/src/bp-activity/js/mentions.js

    r9098 r9100  
    222222
    223223    $( document ).ready(function() {
    224         var users = [];
     224        var loadMentionsInTinyMCE,
     225            loadAttempts = 0,
     226            users        = [];
    225227
    226228        if ( typeof window.BP_Suggestions === 'object' ) {
     
    228230        }
    229231
     232        // Dashoard post 'visual' editor.
     233        loadMentionsInTinyMCE = function() {
     234            if ( loadAttempts < 4 || ! $( 'body' ).hasClass( 'wp-admin' ) ) {
     235                loadAttempts++;
     236
     237                if ( typeof window.tinyMCE === 'undefined' || window.tinyMCE.activeEditor === null || typeof window.tinyMCE.activeEditor === 'undefined' ) {
     238                    setTimeout( loadMentionsInTinyMCE, 500 );
     239                    return;
     240                }
     241            }
     242
     243            $( window.tinyMCE.activeEditor.contentDocument.activeElement )
     244                .atwho( 'setIframe', $( '#content_ifr' )[0] )
     245                .bp_mentions( users );
     246        };
     247
    230248        // Activity/reply, post comments, dashboard post 'text' editor.
    231249        $( '.bp-suggestions, #comments form textarea, .wp-editor-area' ).bp_mentions( users );
     250
     251        // Dashbboard post 'visual' editor.
     252        loadMentionsInTinyMCE();
    232253    });
    233254})( jQuery );
Note: See TracChangeset for help on using the changeset viewer.