Fixed XenForo's TinyMCE custom button addition not working as intended

Van Damm

Member
The code to insert custom bbcode buttons in "js/tinymce/themes/xenforo/editor_template.js" is not quite correct. It now reads
Code:
tinymce.each(tags, function(tag, tagName) {
  tb.add(controlManager.createButton('xenforo_custom_bbcode_' + tag,
      {title : tag[0], image : tag[1], cmd : 'xenForoWrapBbCode', ui : false, value : tagName}
  ));
});
however "tag" is an array so it cannot be used as part of button's name in "'xenforo_custom_bbcode_' + tag". This code fragment should look like
Code:
tinymce.each(tags, function(tag, tagName) {
  tb.add(controlManager.createButton('xenforo_custom_bbcode_' + tagName,
      {title : tag[0], image : tag[1], cmd : 'xenForoWrapBbCode', ui : false, value : tagName}
  ));
});


This way developers will be able to add custom bbcode buttons something array similar to
Code:
, xenforo_custom_bbcode_tags:  { "bbcode": ["Button title", "url/to/image"] }
in "editor_tinymce_init" template hook.
 
Top Bottom