WordPress.org

Ready to get started?Download WordPress

Forums

using gPress in the frontend (5 posts)

  1. grosbouff
    Member
    Posted 3 years ago #

    Hi; as I told you I try to use gPress outside the dashboard; on a frontend tinyMCE.

    I'm able to load tinyMCE with this :

    require_once(ABSPATH . "wp-admin" . '/includes/post.php');

    wp_tiny_mce( false , // true makes the editor "teeny"
    array(
    "editor_selector" => "mceEditor"
    )
    );
    wp_enqueue_script( 'utils.dev', get_bloginfo('wpurl').'/wp-admin/js/utils.dev.js');

    And it works ! The GPress button loads; the popup loads when I click the button;
    the only problem is that in your javascript functions;
    the function insertTag has this line :

    window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, tag);

    My textarea that uses tinyMCE is not #content.
    I can't give this ID because it is used in the theme css.

    So the only thing missing to make that work would be that instead of using 'content', you would use a dynamic element that would be the editor.
    Is it possible ?

    Thanks

  2. Mark Smalley
    Member
    Posted 3 years ago #

    It sounds like a good idea and one I would like to help with, but no ideas come straight to mind on how I might be able to best add the dynamic selector that you are looking for.

    Do you have any ideas on how this might be achieved or why exactly you cannot change the ID of the other content box?

    I will add this request to the list of things that would be nice to look into if we had the time, but if a solution comes to mind in the meantime, I add the feature in.

    Otherwise, it might be best to keep track of support issues via our official forums in the BuddyPress.org community:
    http://buddypress.org/community/groups/gpress/forum/

  3. grosbouff
    Member
    Posted 3 years ago #

    This coud be achieved, I think; if I would duplicate some of your files and changing things like

    window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, tag);

    by my ID.
    But this would be a not so good idea since there are chances that the code broke if you update your plugin.

    So the best way to do it would be to have the way to call your plugin functions from the plugin.

    In this case; you could maybe be able to change 'content' with a dynamic ID name. Maybe in tinyMCE there is a way to get the textarea's ID, or something like that.

    I would be very happy if we could find something for this :)

    Thanks

  4. Mark Smalley
    Member
    Posted 3 years ago #

    I have added two filters (one for the map icon and one for the Foursquare icon) that allow you to change the ID. Those filters are:

    gpress_tinymce_textarea

    and...

    gpress4sq_tinymce_textarea

    Allowing you to do something like:

    function new_gpress_tinymce_textarea() {
        return 'new-id';
    }
    add_filter( 'gpress_tinymce_textarea', 'new_gpress_tinymce_textarea' );

    However, since this is such a minor customized add-on specifically for you (at this point), you will need to wait until the next public release (either version 0.2.4.1.2 or 0.2.4.2) - sorry about that. :-)

  5. Mark Smalley
    Member
    Posted 3 years ago #

    Please note that Version 0.2.4.2 of gPress has now been uploaded to the repository, which includes the filters mentioned above. Please let me know if there are any problems.

    In the future, if you have any additional support requests or feedback, I'd suggest joining the BuddyPress.org community (uses the same username and password as this forum does), where our official gPress forums are - http://buddypress.org/community/groups/gpress/forum/

Topic Closed

This topic has been closed to new replies.

About this Topic