1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Hiding Media button crashes RTE

Discussion in 'Media Gallery Resolved Bugs' started by ManOnDaMoon, Dec 17, 2014.

  1. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    I have an issue when modifying the GALLERY BBCode in order to hide it from the Rich Text Editor.

    Only moderators and admins have all XenGallery permissions set to YES.
    Other groups' permissions are not set.

    I edit the GALLERY BBcode, by removing the path to the BBCode icon URL ("styles/default/xengallery/xengallery_sprite.png") then un-checking the "Sprite" option.

    When I go back to my forums, basic users see no issue, but my moderators and I can't see the RTE. Quick edit does not show. "More options" leaves the RTE place blank (see screenshots below).

    You can see below the empty space left by the RTE. There is a JS error in the console:

    Same error on "More options" page, as explained before:

    I'm currently trying to reproduce the error on a local install.
  2. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    I confirm I am able to reproduce locally with all add-ons but XenGallery disabled.

    The error in firebug is :
    TypeError: c.config.buttonsCustom.custom_gallery is undefined
    gallery...0e3f155 (ligne 6, col. 357)
    EDIT: Thanks for having moved this to bug reports. :)
  3. Chris D

    Chris D XenForo Developer Staff Member

    This is indeed a bug.

    The workaround is relatively simple, though.

    If you navigate to Admin CP > Appearance > Template Modifications

    Look through the list for XenForo Media Gallery and disable the modification of editor_js_setup.

    That will properly disable the editor button along with what you have already done.
    ManOnDaMoon likes this.
  4. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    Thanks @Chris D, I did it the way you mentioned, and the Gallery bbcode button is not showing any more while the RTE is still visible for everyone.
  5. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    Well, I wrote a bit quickly and although it seemed to have worked while I tested earlier, now I have the same issue (RTE crashing) with the "XenGallery_editor_js_setup_gallery_bb_code_setup" template modification disabled. Same error in the console.

    The issue is still present only on pages where the Gallery BbCode has been used (I assume it is because the script is loaded for Gallery Bbcode display purposes). Other forum pages are fine, RTE is available.
  6. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    Another workaround that is OK when leaving the bb code active.
    In the non-minified gallery_bb_code.js, line 18, add the code in red:
    if (data.$textarea[0] == this.textarea[0] && data.editor.options.enableXmgButton && data.config.buttonsCustom.custom_gallery)
  7. Chris D

    Chris D XenForo Developer Staff Member

    This is fixed now, thank you.

Share This Page