1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Please donate today & help us with our growing server costs or buy premium for access to our premium products
    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:
    853
    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