Winter CMS resources and help articles

Simple and to the point. Optimized by the community.

Extend Froala editor

1
by AIC BV, last modified on October 4th, 2023

Example of how to extend the Froala editor

use Backend\Classes\Controller;
public function boot()
{
    // extend richeditor with custom color picker
    Controller::extend(function ($widget) {
        $widget->addJs('/plugins/aic/globals/assets/js/froala-color-picker.js');
    });
}
/*
|------------------
| Extend Richeditor
|------------------
 */
+function ($) { "use strict";
    $(document).render(function() {
        if ($.FroalaEditor) {
            $.FroalaEditor.DEFAULTS = $.extend($.FroalaEditor.DEFAULTS, {
                colorsText: [
                    'REMOVE',
                    '#333333',
                    '#848484',
                    '#E0DFDD',
                    '#F8F6F3',
                    '#FFFFFF',
                    '#FF1616',
                    '#FD5E2B',
                    '#FFE836',
                    '#1EBF80',
                    '#2B7FFD',
                    '#EAF3FF',
                    '#E9B4A6'
                ]
            });
        }
    })
}(window.jQuery);

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?