Install Ckeditor and ResponsiveFileManager on website


#1

Hi. I have many CKEditor editors on your website and the following code:


<textarea class="ckeditor" name="content_pl"></textarea>
<textarea class="ckeditor" name="content_en"></textarea>
<textarea class="ckeditor" name="content_es"></textarea>

<script type="text/javascript">
    $(function () {
        $(".ckeditor").each(function () {
            var el = $(this)[0];
            var instance = CKEDITOR.instances[el.id];
            if (instance) { instance.destroy(true); }      
            CKEDITOR.replace(el, {
                filebrowserBrowseUrl: 'http://localhost/responsive_filemanager/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
                filebrowserUploadUrl: 'http://localhost/responsive_filemanager/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
                filebrowserImageBrowseUrl: 'http://localhost/responsive_filemanager/filemanager/dialog.php?type=1&editor=ckeditor&fldr='
            });
        });
    });
</script>

ResponsiveFileManager components do not work (they do not add to CKEditor). At the moment when I have only 1 ckeditor - then it’s ok. How to fix it?


#2

well for starters why reinvent the wheel…ckeditor defines a replaceAll method.


#3

I’m sorry, I do not know JS. I’m a PHP programmer.
So you do not think I need to do it:

CKEDITOR.replace (el, {
                 filebrowserBrowseUrl: '{{pageTemplate.pageHeader.baseHref}} / app-assets / vendors / js / responsive_filemanager / filemanager / dialog.php? type = 2 & editor = ckeditor & fldr =',
                 filebrowserUploadUrl: '{{pageTemplate.pageHeader.baseHref}} / app-assets / vendors / js / responsive_filemanager / filemanager / dialog.php? type = 2 & editor = ckeditor & fldr =',
                 filebrowserImageBrowseUrl: '{{pageTemplate.pageHeader.baseHref}} / app-assets / vendors / js / responsive_filemanager / filemanager / dialog.php? type = 1 & editor = ckeditor & fldr ='
             });

#4

Assuming all your textareas are to be replaced…

CKEDITOR.replaceAll(function(ta,config) {
                 config = { filebrowserBrowseUrl: '{{pageTemplate.pageHeader.baseHref}} / app-assets / vendors / js / responsive_filemanager / filemanager / dialog.php? type = 2 & editor = ckeditor & fldr =',
                            filebrowserUploadUrl: '{{pageTemplate.pageHeader.baseHref}} / app-assets / vendors / js / responsive_filemanager / filemanager / dialog.php? type = 2 & editor = ckeditor & fldr =',
                            filebrowserImageBrowseUrl: '{{pageTemplate.pageHeader.baseHref}} / app-assets / vendors / js / responsive_filemanager / filemanager / dialog.php? type = 1 & editor = ckeditor & fldr ='
                  }
                  return true;
             });

If there are textareas to be skipped, throw an extra if into the function that returns false for anything that needs to be skipped.