2014-06-30 3 views
3

내가 CK 편집기 (https://github.com/galetahub/ckeditor)의 루비 보석을 사용하고 재산 'langEntries'을 읽을 수 없습니다 나는이 오류 받고 있어요 :CKEditor 4 : catch되지 않은 형식 오류가 : 널 (null)

여기
Uncaught TypeError: Cannot read property 'langEntries' of null 

그것에서 발생하는 것 있어요 코드 :

CKEDITOR.plugins.load = CKEDITOR.tools.override(CKEDITOR.plugins.load, function (a) { 
var d = {}; 
return function (b, c, e) { 
    var i = {}, 
     g = function (b) { 
      a.call(this, b, function (a) { 
       CKEDITOR.tools.extend(i, a); 
       var b = [], 
        l; 
       for (l in a) { 
        var s = a[l], 
         q = s && s.requires; 
        if (!d[l]) { 
         if (s.icons) 
          for (var u = s.icons.split(","), f = u.length; f--;) CKEDITOR.skin.addIcon(u[f], s.path + "icons/" + (CKEDITOR.env.hidpi && s.hidpi ? "hidpi/" : "") + u[f] + ".png"); 
         d[l] = 1 
        } 
        if (q) { 
         q.split && (q = q.split(",")); 
         for (s = 0; s < q.length; s++) i[q[s]] || b.push(q[s]) 
        } 
       } 
       if (b.length) g.call(this, 
        b); 
       else { *ERRORING HERE* 
        for (l in i) { 
         s = i[l]; 
         if (s.onLoad && !s.onLoad._called) { 
          s.onLoad() === false && delete i[l]; 
          s.onLoad._called = 1 
         } 
        } 
        c && c.call(e || window, i) 
       } 
      }, this) 
     }; 
    g.call(this, b) 
} 
}); 
CKEDITOR.plugins.setLang = function (a, d, b) { 
var c = this.get(a), 
    a = c.langEntries || (c.langEntries = {}), 
    c = c.lang || (c.lang = []); 
c.split && (c = c.split(",")); 
CKEDITOR.tools.indexOf(c, d) == -1 && c.push(d); 
a[d] = b 
}; 
CKEDITOR.ui = function (a) { 
if (a.ui) return a.ui; 
this.items = {}; 
this.instances = {}; 
this.editor = a; 
this._ = { 
    handlers: {} 
}; 
return this 
}; 

나는이 Simple Uploads 플러그인을 사용하려고하는데, 모든 언어가 있습니다. 내 디렉토리 구조는 다음과 같다 : 여기 enter image description here

이 오류에 대한 CK 편집기에 대한 문서입니다 : 내 플러그인의 언어 파일의 모든 올바른 형식

http://docs.ckeditor.com/#!/api/CKEDITOR.plugins-method-setLang

, 그래서 문제가 무엇인지 찾기 위해 고군분투 .

이 될 것 해결에 어떤 도움을 크게 감사

편집 : 여기에 영어 랭 파일입니다 -

CKEDITOR.plugins.setLang('simpleuploads', 'en', 
{ 
    // Tooltip for the "add file" toolbar button 
    addFile : 'Add a file', 
    // Tooltip for the "add image" toolbar button 
    addImage: 'Add an image', 

    // Shown after the data has been sent to the server and we're waiting for the response 
    processing: 'Processing...', 

    // File size is over config.simpleuploads_maxFileSize OR the server returns HTTP status 413 
    fileTooBig : 'The file is too big, please use a smaller one.', 

    // The extension matches one of the blacklisted ones in config.simpleuploads_invalidExtensions 
    invalidExtension : 'Invalid file type, please use only valid files.', 

    // The extension isn't included in config.simpleuploads_acceptedExtensions 
    nonAcceptedExtension: 'The file type is not valid, please use only valid files:\r\n%0', 

    // The file isn't an accepted type for images 
    nonImageExtension: 'You must select an image', 

    // The width of the image is over the allowed maximum 
    imageTooWide: 'The image is too wide', 

    // The height of the image is over the allowed maximum 
    imageTooTall: 'The image is too tall' 
}); 
+0

오류 메시지가 아닌 전체 스택 추적을 포함하도록 질문을 편집 할 수 있습니까? 이것이 오류가 실제로 발생하는 곳을 찾는 데 도움이됩니다. –

+0

그 코드는 stacktrace가 아닙니다 :) 유용합니다 ...하지만 이제는 stacktrace를 사용하여 오류의 원인이되는 코드 행을 알려줍니다. offchance에서 당신은 루비 stacktrace가/look-like인지 알지 못합니다. (알아요, 거의 없습니다.) : http://railscasts.com/episodes/24-the-stack-trace?view=asciicast –

+0

That said - 여기에 올릴 가능성이있는 유일한 LOC가 LangEntries가있는 유일한 스택 인 것처럼 보입니다 ... 그래서 stacktrace가 우리에게 훨씬 더 많은 것을주지 않을 것입니다. 하지만이 모든 것을 호출하는 * 코드의 일부를 찾아 낼 수 있습니다. 그러면 올바르게 설정되지 않은 것을 알아낼 수 있습니다. –

답변

3

는 application.js에서 다음 줄을 제거

// = require_tree ./ckeditor 
+3

참고 :'ckeditor' 디렉토리가'.'에 있었기 때문에'// = require_tree. '를 제거해야했습니다. 방금 모든 사용자 정의 스크립트를'app'으로 옮기고 require_tree 호출을'// = require_tree./app'로 대체했습니다. – calas

1

당신이 경우 ckeditor-rails app/assets/javascripts/application.js에 다음을 사용하십시오.

//= require ckeditor-jquery 

해당 언어 값을 확인은 다음과 같이이다 :

config.language = 'en'; 
config.language_list = [ 'en:English', 'es:Spanish' ]; 
4

문제는 방법 레일에서 유래가 자산을 컴파일합니다. 하나의 큰 js 파일을 생성하고 plugin.js 코드가/lang에있는 파일보다 먼저로드되지 않으면 오류가 발생하고 큰 js 파일로 생성 된 파일의 실행이 중지됩니다. 즉, 오류가 발생한 지점을 지난 js 코드가 있으면 실행되지 않습니다. 다음은이 문제를 해결하는 데 도움이되는 내용입니다.

//= require ckeditor/init 
//= require ckeditor/config 
//= require ckeditor/plugins/YOUR_PLUGIN/plugin // plugin.js in folder 
//= require ckeditor/plugins/YOUR_PLUGIN/lang/en // en.js in folder 
//= require_directory . 
관련 문제