4

我尝试按照 elfinder.org 中的说明如何将 CKEditor 与 elFinder 集成但不起作用。有没有集成elFinder的CKEditor的例子,如果有人知道,请分享。

谢谢

4

2 回答 2

1

我在这里找到了 CKEditor 和 elFinder 的示例:http: //elrte.org/redmine/attachments/409/elfinder.html

$().ready(function() {

   var funcNum = window.location.search.replace(/^.*CKEditorFuncNum=(\d+).*$/, "$1");
   var langCode = window.location.search.replace(/^.*langCode=([a-z]{2}).*$/, "$1");

   $('#finder').elfinder({
      url : 'connectors/php/connector.php',
      lang : langCode,
      editorCallback : function(url) {
         window.opener.CKEDITOR.tools.callFunction(funcNum, url);
         window.close();
      }
   })

})
于 2013-05-28T13:21:13.200 回答
-4

如果您使用的是 CKFinder,这可能会有所帮助。尝试以下步骤。

1.下载CKEditor和CKFinder。集成代码可在http://dwij.co.in/ckeditor-ckfinder-integration-using-php/
上获得 2. 将两者的提取代码放在 xampp 内的一个文件夹中,如下所示。3. 创建包含编辑器的索引文件(index.html),代码如下。

    <html>
    <head>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="ckfinder/ckfinder.js"></script>
    </head>
    <body>
        <h1>CKEditor CKFinder Integration using PHP</h1>
        <textarea id="editor1" name="editor1" rows="10" cols="80"></textarea>
    <script type="text/javascript">
    var editor = CKEDITOR.replace( 'editor1', {
        filebrowserBrowseUrl : 'ckfinder/ckfinder.html',
        filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?type=Images',
        filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?type=Flash',
        filebrowserUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
        filebrowserImageUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
        filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
    });
    CKFinder.setupCKEditor( editor, '../' );
    </script>
    </body>
    </html>

所以你的文件夹结构将是这样的:

文档
|_集成
    |_ckeditor
    | |_config.js
    | |_...
    |_ckfinder
    | |_config.php
    | |_...
    |_上传
    |_index.html
  1. 现在在 ckfinder 中打开文件 config.php 并进行以下更改:

    function CheckAuthentication() {
        // WARNING : DO NOT simply return "true". By doing so, you are allowing
        // "anyone" to upload and list the files in your server. You must implement
        // some kind of session validation here. Even something very simple as...
        // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
        return true; // not good option though; go for sessions
    }
    $baseUrl = 'http://localhost/integrated/uploads/';
    $enabled = true;
    $config['SecureImageUploads'] = false;
    $config['ChmodFolders'] = 0777 ;
    
  2. 现在打开 urlhttp://localhost/integrated/并尝试上传图片。
于 2013-05-30T09:15:17.617 回答