Need to integrate Elfinder File manager with CKEditor

随声附和 提交于 2019-12-23 19:42:35

问题


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.


回答1:


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..



来源:https://stackoverflow.com/questions/12985676/need-to-integrate-elfinder-file-manager-with-ckeditor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!