2015-04-24 30 views
1

我試圖CKFinder與CKEDITOR 4.4.7集成,並獲得頁面加載以下錯誤:CKFinder產量:「類型錯誤:f.config未定義」

TypeError: f.config is undefined 
ckfinder.js (line 6, col 12104) 
...;var p=o.indexOf('?')!== -1?'&':'?';f.config.filebrowserBrowseUrl=o;f.config... 
              ^^^^^^^^ 

這裏的示例頁面:

<script type='text/JavaScript' src='/includes/static/js/ckeditor/ckeditor.js'></script> 
    <script type='text/JavaScript' src='/includes/static/js/ckfinder/ckfinder.js'></script> 
    <p>entry box 

    <form action='test.php' method='post'> 
     <p> 

      <textarea class='ckeditor' id='citation' name='citation'>citation</textarea> 
      <script> 
       CKEDITOR.replace('citation', { 
        uiColor: '#FFF6DA', 
        allowedContent: true, 
        filebrowserBrowseUrl: '/includes/static/js/ckfinder/ckfinder.html', 
        filebrowserImageBrowseUrl: '/includes/static/js/ckfinder/ckfinder.html?type=Images', 
        filebrowserFlashBrowseUrl: '/includes/static/js/ckfinder/ckfinder.html?type=Flash', 
        filebrowserUploadUrl: '/includes/static/js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', 
        filebrowserImageUploadUrl: '/includes/static/js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', 
        filebrowserFlashUploadUrl: '/includes/static/js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',       

        height:100 
       }); 

       CKEDITOR.instances['citation'].on('instanceReady', function() { 
        // Output self-closing tags the HTML4 way, like <br>. 
        this.dataProcessor.writer.selfClosingEnd = '>'; 


       });     

       CKFinder.setupCKEditor('citation', '/includes/static/js/ckfinder/'); 

      </script> 
     <input type='submit'> 
    </form> 

上傳按鈕沒有被推測創建,因爲上面的f.config錯誤的: enter image description here

這裏是CKEditor的/ config.js:

CKEDITOR.editorConfig = function(config) { 

    // The default plugins included in the basic setup define some buttons that 
    // are not needed in a basic editor. They are removed here. 
    config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript'; 

    config.extraPlugins = 'justify,onchange'; 

    // Dialog windows are also simplified. 
    config.removeDialogTabs = 'link:advanced'; 

    config.disableNativeSpellChecker = false; 

};

和未修改ckfinder/config.js:

CKFinder.customConfig = function(config) 
{ 
     // Define changes to default configuration here. For example: 
     // config.skin = 'v1'; 
     // config.language = 'fr'; 
}; 

什麼引起的f.config錯誤?

+0

沒有CKEditor 4.7這樣的東西。 – Necreaux

回答

1

CKFinder.setupCKEditor需要一個實例,而不是編輯器的id。

用途:

CKFinder.setupCKEditor(CKEDITOR.instances['citation'], '/includes/static/js/ckfinder/'); 

或簡單地傳遞null作爲第一個參數。更多信息查詢http://docs.cksource.com/CKFinder_2.x/Developers_Guide/PHP/CKEditor_Integration

+0

清除了錯誤,但當我單擊編輯器中的圖像工具時,仍然沒有看到「上傳」選項。 –

+0

其實,完全註釋掉'CKFinder.setupCKEditor'。您已經將文件瀏覽器*選項傳遞給CKEditor.replace()。這樣做後,更新您的問題中的代碼。 –

+0

註釋掉CKFinder.setupCKEditor行,現在只使用filebrowser *選項。仍然沒有獲得圖片彈出窗口中的「上傳」標籤。只是嘗試了另一種方式(註釋掉filebrowser *並添加了返回CKFinder行) - 仍然沒有上載選項卡。沒有JS錯誤。 –