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

How can I remove some of the Redactor toolbar buttons?

Discussion in 'XenForo Questions and Support' started by AndyB, Jun 20, 2013.

  1. AndyB

    AndyB Well-Known Member

    How can I remove some of the Redactor toolbar buttons? For example I would like to remove the Text color, Font Size and Font Family buttons.

    Thank you.
     
  2. Matthew Hawley

    Matthew Hawley Well-Known Member

    Go to the editor_js_setup and look at the list under RELANG.xf = {

    I'm not %100 percent sure if this will work, but doesn't hurt to give it a try. :)
     
  3. AndyB

    AndyB Well-Known Member

    I tried editing the editor_js_setup template but it doesn't remove the toolbar buttons.
     
  4. Matthew Hawley

    Matthew Hawley Well-Known Member

    Try editing this:

    Root of xenforo installation -> library -> XenForo -> ControllerPublic (I believe) -> Editer -> redactor.js
     
    AndyB likes this.
  5. AndyB

    AndyB Well-Known Member

    Okay figured it out. Edit the following file:

    /js/redactor/redactor.js

    For example to remove the Text Color button, remove the following code found on line #546

    Code:
            fontcolor:
             {
               title: RLANG.fontcolor,
               func: 'show'
             },
    
     
    Anthony Parsons likes this.
  6. AndyB

    AndyB Well-Known Member

    Thank you for your help, Matthew.
     
  7. Matthew Hawley

    Matthew Hawley Well-Known Member

    My Pleasure! And I see I got the Editor wrong...It was redactor. :p
     
  8. Andy.N

    Andy.N Well-Known Member

    But it will get rewritten the next time you update xF, right?
     
    xf_phantom likes this.
  9. AndyB

    AndyB Well-Known Member

    Correct. Anytime you modify the code directly you always want to carefully document the changes so that when you upgrade you can repeat the changes.
     
  10. cclaerhout

    cclaerhout Well-Known Member

    It seems a solution has been found here. May be you can get close to the developer.
     
    Andy.N likes this.
  11. AndyB

    AndyB Well-Known Member

    I found a better solution to remove the three font buttons.

    1) Rename /js/xenforo/bb_code_edit.js to /js/xenforo/bb_code_edit_original.js
    2) Copy /js/xenforo/full/bb_code_edit.js to /js/xenforo/bb_code_edit.js
    3) Edit /js/xenforo/bb_code_edit.js and comment out the following starting on line #57

    Code:
          /*if (!bC || bC.extended)
           {
             buttons.push(['fontcolor', 'fontsize', 'fontfamily']);
           }*/
    
     
  12. Jeremy

    Jeremy XenForo Moderator Staff Member

    That change will also need reapplied on every upgrade, as well as merging in any updates.
     
  13. AndyB

    AndyB Well-Known Member

    I carefully document any code changes so that I can quickly and easily reapply them when I upgrade.
     
  14. AndyB

    AndyB Well-Known Member

    Thank you for the link, cclaerhout.

    I find it much easier to modify the code directly than to use add-ons.
     
  15. le-melvin

    le-melvin Member

    Hello I am looking to change redactor_toolbar URL ( http://google.com [/ URL] [/ b]) cordially Melvin
     

Share This Page