3

Trying to find on google how to integrate elfinder with CKeditor, but not works. There is an instruction here but, its not work. It able to open elfinder. but, when i double click on image, it do not pass URL to image filed, but open picture viewer.

Try again and find this link but, its not help too. And some people said that coding at github is usable for version 1. Now, elfinder is using version 2.0 rc1.

So, is there anyone could help me to integrate with CKeditor? It will be great. Thanks.

Niraj
  • 517
  • 1
  • 9
  • 23
Yohan -
  • 41
  • 1
  • 2

1 Answers1

4

in elfinder.html replace this code:

    <!-- elFinder initialization (REQUIRED) -->
    <script type="text/javascript" charset="utf-8">
        $().ready(function() {
            var elf = $('#elfinder').elfinder({
                url : 'php/connector.php'  // connector URL (REQUIRED)
                // lang: 'ru',             // language (OPTIONAL)
            }).elfinder('instance');
        });
    </script>

with code from wiki:

<script type="text/javascript" charset="utf-8">
// Helper function to get parameters from the query string.
function getUrlParam(paramName) {
    var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;
    var match = window.location.search.match(reParam) ;

    return (match && match.length > 1) ? match[1] : '' ;
}

$().ready(function() {
    var funcNum = getUrlParam('CKEditorFuncNum');

    var elf = $('#elfinder').elfinder({
        url : 'php/connector.php',
        getFileCallback : function(file) {
            window.opener.CKEDITOR.tools.callFunction(funcNum, file);
            window.close();
        },
        resizable: false
    }).elfinder('instance');
});</script>

tutorial is not so obvious but works ok..

  • do you have the link for the wiki? I tried this option, but when I dbclick, it add a broken link to the ckeditor (the image on elFinder show correctly) – Michel Ayres Sep 08 '15 at 17:04
  • I fixed it with the comments [on git](https://github.com/Studio-42/elFinder/issues/546) `getFileCallback : function(file) { window.opener.CKEDITOR.tools.callFunction(funcNum, file.url); window.close(); },` it should be **file.url** instead of just **file** – Michel Ayres Sep 08 '15 at 18:13