Different buttons for Redactor in Perch 3?.

  • Hello,


    So currently I have this in addons/plugins/editors/config.js:

    Code

    1. Perch.UserConfig.redactor = function(){
    2. // LOAD PLUGINS
    3. var load = function(cb) {
    4. cb();
    5. };
    6. // SETTINGS
    7. var get = function(profile, config, field) {
    8. // PLUGINS
    9. // FORMATTING
    10. config.formatting = ['p', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
    11. // BUTTONS
    12. config.buttons = ['bold','italic'];
    13. config.plugins = [];
    14. return config;
    15. };
    16. return {
    17. 'get': get,
    18. 'load': load
    19. }
    20. }();

    Display Less

    How can I specify different buttons and formatting, etc according to the size value I add to the textarea in the template? It was a really useful function to stop non-tech savvy editors from screwing things up!



    thanks

    iosman

  • drewm

    Approved the thread.
  • Hello,


    How can I specify different buttons and formatting, etc according to the size value I add to the textarea in the template?


    You can specify a profile with the editor-config attribute:


    HTML
    1. <perch:content id="text" type="textarea" label="Text" editor="redactor" editor-config="minimal" html>


    JavaScript
    1. var get = function(profile, config, field) {
    2. if(profile == 'minimal') {
    3.     // hide some buttons
    4.     config.buttonsHide = ['link', 'bold'];
    5. }
    6. return config;
    7. };

  • thanks my issue has been fixed.