Fixed Hiding Media button crashes RTE

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:
upload_2014-12-17_22-46-25.webp


Same error on "More options" page, as explained before:
upload_2014-12-17_22-47-13.webp

I'm currently trying to reproduce the error on a local install.
 
I confirm I am able to reproduce locally with all add-ons but XenGallery disabled.

The error in firebug is :
Rich (BB code):
TypeError: c.config.buttonsCustom.custom_gallery is undefined
gallery...0e3f155 (ligne 6, col. 357)

EDIT: Thanks for having moved this to bug reports. :)
 
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.
 
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.

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.
 
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.
 
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:
Rich (BB code):
if (data.$textarea[0] == this.textarea[0] && data.editor.options.enableXmgButton && data.config.buttonsCustom.custom_gallery)
 
Top Bottom