Opened 15 years ago
Closed 15 years ago
#4348 closed Bug (fixed)
"l.lang.about is undefined" => editor does not open => Failed base path detection
Reported by: | Andrwe | Owned by: | Garry Yao |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.3 |
Component: | General | Version: | |
Keywords: | Confirmed Review+ | Cc: | Erik Kangas, brauliobo@…, Frederico Caldeira Knabben |
Description
I'm using Firefox 3.5.2 and CKeditor-nightly 4165.
If I call the replace method the textarea disapears but the editor doesn't open. Firebug shows the error "l.lang.about is undefined on line 34" and I saw that en.js and config.js don't send anything as response. This also happens if I move one of your examples out of _samples and adapt the pathes.
Attachments (2)
Change History (22)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
i also got the same error the problem for me was that it did not loaded the language file. So check if it loads the language file you can check that whit firebug start the page were you have your ckeditor instance activated(CKEDITOR.replace()) make sure it is activated(what i mean whit this, in your case, is that you dont see the text anymore, the point were it goes wrong) and then open your firebug click on the HTML tab and see if it loads all the .js files the following files should be loaded: ckeditor.js, config.js, and you lang file as my native language is dutch it should be nl.js(this depends on what default language you have loaded)
comment:3 Changed 15 years ago by
Cc: | Erik Kangas added |
---|---|
Summary: | "l.lang.about is undefined" => editor does not open → "l.lang.about is undefined" => editor does not open => Failed base path detection |
I also encountered this bug. It happened for me because I use server-side maps in apache and thus load "/path/ckeditor.var" instead of "ckeditor.js". This allows the server to negotiate gz vs normal versions of the file.
Changing to use the ".js" version made the error go away. With the ".var" in place, firebug shows CK Editor trying to load the language file from the wrong path.
My guess is that CK Editor is auto-detecting its path based on looking for its "ckeditor.js" file. In FCK Editor, we could set the base path explicitly -- I don't see a way to do this in the configuration area. Perhaps this could be added back in?
comment:4 Changed 15 years ago by
Ok - I have found the workaround. Set the global CKEDITOR_BASEPATH to point to your install point before loading ckeditor.js. This overrides the failing auto-detection for those of us with non-standard script names.
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#constructor
This is still either a bug or something that should be documented in the integration instructions.
comment:6 Changed 15 years ago by
Keywords: | Confirmed added |
---|
Besides improving the documentation, I think that it would be useful if the code could detect and give a warning explaining the problem. In the uncompressed code of core/ckeditor_base.js would be something along the lines of
if ( !path ) { var scripts = document.getElementsByTagName( 'script' ); for ( var i = 0 ; i < scripts.length ; i++ ) { var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i ); if ( match ) { path = match[1]; break; } } if ( !path ) { alert( "Path of CKEditor not found, please set the CKEDITOR_BASEPATH variable.") ; } }
But it would be better if that was shown in the page (as the filesystem warning for Firefox in FCKeditor 2) so it's easy to copy and can be linked to the docs.
comment:7 Changed 15 years ago by
Milestone: | → CKEditor 3.3 |
---|
Some useful message should definitely be shown here. Not sure the in-page solution is doable, but at least the alert.
Btw, we have instructions about it in the docs:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Specifying_the_Editor_Path
It looks like we need to give more visibility to it somehow.
comment:8 Changed 15 years ago by
Also, check out the "Attention" paragraph at Step 1 in the Integration docs page.
comment:9 Changed 15 years ago by
Cc: | brauliobo@… added |
---|
workaround CKEDITOR_BASEPATH works but the path must ends with slash. using javascripts with webkitgtk.
http://code.google.com/p/gebr/source/browse/trunk/libgebr/src/gui/gui/help.c?spec=svn1563&r=1563
Changed 15 years ago by
Attachment: | 4348.patch added |
---|
comment:10 Changed 15 years ago by
Keywords: | Review? added |
---|---|
Owner: | set to Garry Yao |
Status: | new → assigned |
Proposing a more robust way of determining CKEDITOR_BASEPATH.
comment:11 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
The patch will pick the path of whatever is the last js file, even if it isn't related to CKEditor at all.
comment:12 Changed 15 years ago by
Hm. That doesn't seem like it really helps. For example, we have a whole directory tree of JavaScript files used for various applications. It is actually quite unlikely [for us] that the last loaded JS file will be in the same path as the CKEditor code.
comment:13 follow-up: 15 Changed 15 years ago by
A different approach to get the filename of the current script could be to use some code like http://github.com/emwendelin/javascript-stacktrace does.
I'm not sure if it does generate the file names for every browser, I think that when I started reading about it I saw some comment about not being able to get it in IE or Opera.
comment:14 Changed 15 years ago by
Keywords: | Review+ added; Review- removed |
---|
Sorry, I've realized now that the patch is very clever and a very good idea.
comment:15 Changed 15 years ago by
Replying to alfonsoml:
A different approach to get the filename of the current script could be to use some code like http://github.com/emwendelin/javascript-stacktrace does. I'm not sure if it does generate the file names for every browser...
The [script http://eriwen.com/javascript/js-stack-trace/] is originally created by Eric to print stacktrace cross-browser, by throwing and catching an exception in place, while unfortunately it seems only Chrome and Firefox report line number in Error object, neither IE or Safari.
comment:16 Changed 15 years ago by
Cc: | Frederico Caldeira Knabben added |
---|---|
Keywords: | Review? added; Review+ removed |
Obviously that the proposed approach doesn't work with dynamic <script> and AJAX eval, while considering the fact that editor base codes should be seldom loaded in the above ways, it's OK for most of the cases.
Pleas leave this review role to Fred.
comment:17 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
The docs specify three specific cases where CKEDITOR_BASEPATH is needed. While the patch fixes the two edge cases, it still doesn't bring any benefit for the most common usage case:
"The original editor script is merged with other scripts used in the page, to reduce the number of files being downloaded."
In reality, there is no solution to magically find out the base path in this case. In this ticket we have proposed showing an alert to the user (the developer) so s/he will be aware that CKEDITOR_BASEPATH must be used. The proposed patch is not addressing this solution.
Changed 15 years ago by
Attachment: | 4348_2.patch added |
---|
comment:18 Changed 15 years ago by
Keywords: | Review? added; Review- removed |
---|
This's really an exception (that been shown to application developers) instead of an alert that bother the user.
comment:19 Changed 15 years ago by
Keywords: | Review+ added; Review? removed |
---|
Ok to have it as an exception. Please change the message to the following:
'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.'
I got the same error. After loading the CKEditor.js file in its own script tag like this <script type="text/javascript" src="'.HOME.'/ckeditor/ckeditor.js'.'"></script> instead of appending it at the end of a generated file the error vanished