BbCodes & Buttons Manager

BbCodes & Buttons Manager 3.3.5

No permission to download
@cclaerhout Do you mind to update this addon to remove conflict with XenGallery? Your current way for adding buttons by extends editorOptions.buttons will break other addons that add buttons to editor.

If buttons are just to insert bbcode tag (without popup), I will do not need to use any JS as XF already supported it.

PHP:
public static function editor_setup(XenForo_View $view, $formCtrlName, &$message, array &$editorOptions, &$showWysiwyg)
    {
        if ($showWysiwyg)
        {
            $editorOptions['json']['buttons']['insertAlbum'] = array(
                'title' => new XenForo_Phrase('sonnb_xengallery_insert_album'),
                'tag' => 'album'
            );
            $editorOptions['json']['buttons']['insertContent'] = array(
                'title' => new XenForo_Phrase('sonnb_xengallery_insert_content'),
                'tag' => 'content'
            );
        }
    }

If popup required then some JS are needed but will not break other buttons as we already have class selector for each buttons. So do not need to extend current editorOptions anymore.

Thank you to have provided a concrete example that easily shows how to add custom buttons to the XenForo stock editor. It's just sad this information didn't come from the XenForo developpers themselves. I've just bought your Gallery, could you please send me the version which is incompatible. Even if there's an easier way now, and thanks to you, to add custom buttons to the stock editor, I would like to understand what's wrong with the JavaScript code I was using. I will try to update the addon as soon possible, but tomorrow is my wife birthday and I have to send some presents to France so they can arrive for Christmas.
 
Thank you to have provided a concrete example that easily shows how to add custom buttons to the XenForo stock editor. It's just sad this information didn't come from the XenForo developpers themselves. I've just bought your Gallery, could you please send me the version which is incompatible. Even if there's an easier way now, and thanks to you, to add custom buttons to the stock editor, I would like to understand what's wrong with the JavaScript code I was using. I will try to update the addon as soon possible, but tomorrow is my wife birthday and I have to send some presents to France so they can arrive for Christmas.
I am glad that it helps you. If you just need a copy to test, please tell me and I will refund you, do not need to buy it. Happy birthday to yours soul mate ;)
 
I am glad that it helps you. If you just need a copy to test, please tell me and I will refund you, do not need to buy it. Happy birthday to yours soul mate ;)
Thanks you :) And for your addon, I've said a lot time ago that I was interested in the photos exif functions, so of course I will keep it even if I might only start to use in a few months.

A little feedback:
So about the bug, let's call @Milano, because this Javascript will have a similar problem.
First of all, in the quick tutorial to add buttons/plugins to Redactor, the way to extend data is not correct. It must be recursive. In other words, instead of using this bad code from mine:
Code:
$textarea.data('options', $.extend(redactorOptions, myOptions));
It should have been instead only with the bolean true as first parameter to make the function recursive:
Code:
$.extend(true, redactorOptions, myOptions);

With the recursive mode, it will fix a bug that has the Milano Smiley Manager with some addons (for example the "vfcoders-hide-hack" of @Aayush Agrawal when the option to automatically display the editor on focus) without having any problems with XenGallery.

Unfortunately, this solution will not work with the way XenGallery adds some buttons to the editor, which will be most certainly the official way of XenForo. The buttons are inside the JS object but still doesn't appear. I don't understand why. So the Bbm addon needs anyway to change the way it adds buttons to the editor.
 
Thanks you :) And for your addon, I've said a lot time ago that I was interested in the photos exif functions, so of course I will keep it even if I might only start to use in a few months.

A little feedback:
So about the bug, let's call @Milano, because this Javascript will have a similar problem.
First of all, in the quick tutorial to add buttons/plugins to Redactor, the way to extend data is not correct. It must be recursive. In other words, instead of using this bad code from mine:
Code:
$textarea.data('options', $.extend(redactorOptions, myOptions));
It should have been instead only with the bolean true as first parameter to make the function recursive:
Code:
$.extend(true, redactorOptions, myOptions);

With the recursive mode, it will fix a bug that has the Milano Smiley Manager with some addons (for example the "vfcoders-hide-hack" of @Aayush Agrawal when the option to automatically display the editor on focus) without having any problems with XenGallery.

Unfortunately, this solution will not work with the way XenGallery adds some buttons to the editor, which will be most certainly the official way of XenForo. The buttons are inside the JS object but still doesn't appear. I don't understand why. So the Bbm addon needs anyway to change the way it adds buttons to the editor.
I highly appreciate your investigation.
 
I highly appreciate your investigation.
Ok I understand why it doesn't work. It's actually quite logical :p. The logic of the Bbm is to allow the admin to configure himself the layout of the buttons, included XenForo default buttons. So it replaces the whole layout. With the above fix, I've said that your buttons were inside the JS object. So they just need to be activated with an "orphan button". There are some special functions named "Bypass button commands" & "Bbm button name" that I often use with TinyMCE. It seems I had also implemented it for the XenForo Redactor Editor. I give you an example in the attached file (it takes 30 seconds to create it).

So I'm going to publish the above fix and I will wait a little to use the editorSetup listener to do the same thing that the manual JavaScript file already does.
 

Attachments

cclaerhout updated BbCodes & Buttons Manager with a new update entry:

Version 2.3.5 released

Version 2.3.5 released
  • Add a JavaScript fix for the integration of buttons with the XenForo Redactor editor. This fix would avoid any errors when other addons (for example the XenGallery addon) try to extend the datas of the Redactor element.
    Thanks to @Sonnb
  • Add a fix to the Editor Checker for XenForo 1.1.x
    Thanks to @jonoathome
  • Some phrases have been...

Read the rest of this update entry...
 
@ForestForTrees
You might be interested in this:
https://github.com/cclaerhout/xen_FontAwesome_BbCode

That's just something quickly done but it seems functional. All classes of Font Awesome should be working except the list (it doesn't suite a forum message anyway), to have the direct names which must be used inside the Bb Code option, check this file (line 183). The hardest to do will be the user interface and I don't know if I will have time to do it.

P.S: as usual the bbcode xml file is inside the extra directory.

View attachment 63141
Source:
Code:
[fa=fa-camera-retro|left|fa-2x][SIZE=7][B]Text[/B] [/SIZE][/fa]
[fa=fa-lg|fa-square-o|fa-stack-2x|fa-stack|fa-twitter|fa-stack-1x] Piou piou[/fa]

Note that for the stack mode (two icons combined together), all options before the option "fa-stack" will be for the first icon, then all options after it will be for the second icon. Only one exception: the global size option (ie:"fa-lg")will be applied to the wrapper).
Wow, that's amazing. I love that you got stacking going, too. To be honest, I don't even use FA just yet. I'm just an instigator. :) . @Matthew Hawley and @Adam Howard might be interested, though, since their users are already requiring the master CSS file.
 
I confirm bug on clean XF 1.2.4 with BBM 2.3.5 (Redactor editor)
When edit post (inline or separate) custom added buttons not displaying
 
In my admin CP, when I click "Buttons manager", or Add New BBcode, have an error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
P/s: XF 1.2.4 with BBM 2.3.5
 
Last edited:
@fly_indiz
I've just upgraded to my local installation, I can't reproduce the problem.

@Lil.Tee
No problem for me either. When you go to the error log {yourBoard}/admin.php?logs/server-error, what is the full error?
 
@cclaerhout
It's nothing at /admin.php?logs/server-error, but when I click "Buttons manager", or Add New BBcode, have an error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2 Server at mydomain.com Port 80
 
@Lil.Tee cannot replay your second problem. It seems to bad server configuration. I use last nginx 1.5.7 + php 5.5.7 + mysql 5.6.15 with manual settings.
 
@Lil.Tee
With PHP 5.3, it shouldn't be a php version problem. Can you try to contact your host so he gives you some more details about the error (it should be inside the log).

@fly_indiz
I will try on a blank install. You don't have any JS error inside the console?

By the way there's a typo in this file at the line 116, the array key should be "separator" instead of "seprarator".
 
@cclaerhout
options/list/bbm_xenforo_bbcodes_control
[Wed Dec 18 17:59:57.121686 2013] [core:error] [pid 556701] [client 1.55.80.67:50933] End of script output before headers: admin.php, referer: http://domain.com/admin.php?add-ons/
[Wed Dec 18 18:05:25.804278 2013] [core:error] [pid 561878] [client 1.55.80.67:51224] End of script output before headers: admin.php, referer: http://domain.com/admin.php
[Wed Dec 18 18:06:27.830223 2013] [core:error] [pid 564631] [client 1.55.80.67:51256] End of script output before headers: admin.php, referer: http://domain.com/admin.php
[Wed Dec 18 18:38:29.099842 2013] [core:error] [pid 602294] [client 1.55.80.67:52072] End of script output before headers: admin.php, referer: http://domain.com/admin.php
[Wed Dec 18 18:39:55.207551 2013] [core:error] [pid 599815] [client 1.55.80.67:52106] End of script output before headers: admin.php, referer: http://domain.com/admin.php?bbm-buttons/
 
Top Bottom