Search code examples
redactor

Redactor plugins are NOT visible when we load the redactor via ajax


I'm using new Redactor 2.2. I wanted to use this Redactor after ajax call. Similar to https://imperavi.com/redactor/examples/ajax/

I can initiate the redactor and it showing but I could not add plugins to this. Even their plugin ( source code, font alignment, font size, font color etc ) are not showing ( But other buttons which are not plugin are showing as in the above URL )

    $.ajax({
        type: "POST", url: "myurl", data: "", dataType: "json",
        success: function (data) {
            $('#divReplacer').html(data['content']);
            $("#divReplacer .htmlEditor").redactor({
                plugins: ['source', 'fontcolor', 'fontfamily', 'fontsize']
            });
        }
    });

Old Redactor worked fine with the above ajax call.

These plugins are showing perfectly if we load the redactor without ajax call.

Anyone face this issue ?


Solution

  • I did the following modification to all plugin JS file and now it is working :)

    $.Redactor.prototype.fontsize = function()

    change to

    RedactorPlugins.fontsize = function()