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

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

Discussion in 'Resolved Bug Reports' started by Van Damm, May 30, 2012.

  1. Van Damm

    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.
     
  2. Mike

    Mike XenForo Developer Staff Member

    Changed, thanks.
     

Share This Page