• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Cel Editor Button Management

cellarius

Active member
#1
Exploring xenForo to find out whether I could do what I need with it, one of the first things I tried to find out was whether I could add additional buttons to the editor. Taking some inspiration from ragtek and this thread, I found the buttons to be hardcoded and found no way different addon coders could add buttons each. If there is, I'll don a tinfoil hat and blame my inexperience with xF so far :D

What does it do?

This simple (but quite powerfull) button manager gets around this problem by taking the button configuration for the two xF editor toolbars into two templates. This solution offers the following advantages:
  • existing buttons can easily be added, removed, or moved about (yes, I am aware that removing buttons will not prevent people from simply typing bbcode; it can still be useful if you trigger non-bbcode actions by button)
  • custom buttons can easily be added; addon developers could simply point to this addon
  • the full flexibility of xenForos template conditionals can be used on each single buttons or button groups, making it easy to show buttons to certain usergroups only for example (see Shadabs how-to)
Minor disadvantage:

  • Since the templates overwrite the xF button configuration, new buttons will have to be added manually to the templates
How does it work?

The configuration templates are CelEditorButtons1 and CelEditorButtons2. The buttons are listed comma seperated and each in a new line in the templates for better overview. See the attached screenshots for an example.
xFbuttons.JPG xFbuttons_result.JPG
Explanation: Bold and italic buttons have changed position, strikethrough has been removed, and a custom button ("celphotopopup") has been added. The alignment buttons have been wrapped by a condition, as has the image bbcode. They are hidden for the current users usergroup.

Installation

Upload the library directory into your xF root directory. Install the included .xml file as an addon. Done.
 

Attachments

cellarius

Active member
#2
For Reference:


The buttons currently present in xF in toolbars 1 and 2 are:
Code:
removeformat,
|,
fontselect,
fontsizeselect,
forecolor,
xenforo_smilies,
|,
undo,
redo
Code:
bold,
italic,
underline,
strikethrough,
|,
justifyleft,
justifycenter,
justifyright,
|,
bullist,
numlist,
outdent,
indent,
|,
link,
unlink,
image,
xenforo_media,
|,
xenforo_code,
xenforo_custom_bbcode
 
R

ragtek

Guest
#6
[offtopic]
It would be a**kicking add-on if the button names would be replaced with the button icons which could be placed via drag & drop:D
[/offtopic]
 

cellarius

Active member
#8
Do you have uploaded the library directory in the .zip-file into your xF-root directory? It will add the folder CelEditorButtons to your library folder, containing Listener.php.
 

cellarius

Active member
#9
Anyway, it would be really easy for Kier and Mike to add the editor configuration that is now in the js file to templates (or one template), just like this addon does. I'd sure like to see this become obsolete (hint, hint). Hm, should probably make a suggestion out of this.
 

vkams

Active member
#14
After installing this addon I tried to add spoiler button (in vain), but than my QuickReply visual editor could not load toolbars and it displays only raw text. I've uninstalled the mod, but quick reply is still broken. How to repair it??!
 

vkams

Active member
#18
Oh, all return to normal work.

I do ask developers to improve editor and give us simple way for addition custom buttons for bb-codes (images and actions)!
 

Trekkan

Well-known member
#19
Installed this on 1.1 B5, but all toolbars are gone from the editor, just an empty text box displays. Still looking to see what might be wrong, but so far, nada.