1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. If you want premium products then purchase our VIP or SVIP plans
  3. Dont forget read our rules HERE Also anyone caught Leeching this content or Scamming will be banned on numerous networks.
    Dismiss Notice
  4. Dont forget we do not allow Multiple Accounts, so all of your accounts as well as your IP will be banned.
    Dismiss Notice
  5. Tired of Download Limits ? UPGRADE Today!
    Dismiss Notice

FREE disable text colour-formatting in editor

Discussion in 'Xenforo Template Mods & Extras' started by HAWK, Mar 21, 2016.

  1. HAWK

    HAWK Administrator Staff Member ADMIN

    Likes Received:
    1,143
    Trophy Points:
    113
    Gender:
    Male
    due to chrome pasting issues (pasting colour-formatted text), i have elected to completely disable all colour functionality from tinyMCE.
    • pasted colour-formatting will be stripped when posted
    • colour-format button will not be visible
    • manually entered [color] tags will silently fail
    • php code colour-formatting is unaffected (syntax highlighting)
    • the effect is not retroactive
    in the php file: /library/XenForo/Html/Renderer/BbCode.php
    (line 51)
    find:
    Code:
    'color' => array('$this', 'handleCssColor'), 
    comment it out:
    Code:
    /*        'color'          => array('$this', 'handleCssColor'),*/
    (line 645)
    find:
    Code:
    public function handleCssColor($text, $color)
     {
     return "[COLOR=$color]{$text}[/COLOR]";
     } 
    comment it out:
    Code:
    /*public function handleCssColor($text, $color)
        {
            return "[COLOR=$color]{$text}[/COLOR]";
        }*/
    in the file /library/XenForo/BbCode/Formatter/Base.php
    (line 296)
    find:
    Code:
    'color' => array(
    'hasOption' => true,
    'optionRegex' => '/^(rgb\(\s*\d+%?\s*,\s*\d+%?\s*,\s*\d+%?\s*\)|#[a-f0-9]{6}|#[a-f0-9]{3}|[a-z]+)$/i',
    'replace' => array('<span style="color: %s">', '</span>')
    ), 
    replace with:
    Code:
    'color' => array(
    'hasOption' => true,
    'optionRegex' => '/^(rgb\(\s*\d+%?\s*,\s*\d+%?\s*,\s*\d+%?\s*\)|#[a-f0-9]{6}|#[a-f0-9]{3}|[a-z]+)$/i',
    'replace' => array('<span>', '</span>')
    ),
    in the js file: /js/tinymce/themes/xenforo/editor_template.js
    (line 985)

    find:
    Code:
    theme_xenforo_buttons1 : 'removeformat,|,fontselect,fontsizeselect,forecolor,xenforo_smilies,|,' + undoRedoButtons, 
    remove 'forecolor':
    Code:
    theme_xenforo_buttons1 : 'removeformat,|,fontselect,fontsizeselect,xenforo_smilies,|,' + undoRedoButtons,
     

Share This Page

Post thread