How to Stop Perch Stripping Code from Textarea?

  • I paste a script in the html view of a textarea block in the CMS, I hit save and the script output shows up on the site correctly. But when I go back to edit it, the script has been stripped out by some automatic process, which is leaving html headers and suchlike alone. Saving again saves it without the html. How can I get Perch to stop stripping out my code?


    <perch:content id="body" type="textarea" label="Body Copy" html="true" editor="redactor" />

  • Seems like it's the Redactor editor that's stripping the code. There's a true/false setting in Redactor to fix this, but changing it in Perch is somewhat convoluted since it's part of the core files. Can someone let me know where I'm going wrong?

    In /config/config.php I added the line:
    define('PERCH_CUSTOM_EDITOR_CONFIGS', true);


    I added the new (blank) file config.js here:
    /addons/plugins/editors/config.js


    I pasted this code in the config.js file:


    Perch.UserConfig.redactor = function () {

    var get = function (profile, config, field) {

    HtmlEditor.RemoveScripts = false;

    return config;

    };

    var load = function (cb) {

    cb();

    };

    return {

    'get': get,

    'load': load

    }

    }();

  • drewm

    Approved the thread.