Closed vaab closed 11 years ago
This seems to be a recurrent point of failure for CKEDITOR inclusion in various frontend, with similar strange conditions.
The code which is faulty is in the provided ckeditor.js
and reads:
this.base.call(this, b, {
panel: {
className: "cke_menu_panel",
attributes:{
"aria-label": b.lang.contextmenu.options
},
zIndexOffset:-2}
}
it's the b.lang.contextmenu.options
which fails as b.lang.contextmenu
is undefined
.
I'm looking into this.
Seems I found the culprit:
CKEditor will load scripts dynamically. Especially the language files which are located in the subdirectory lang/{en,en,...}.js
. To load a script it uses CKEDITOR.scriptLoader.load
method by giving it the supposed URL where we could find the target js files. This is the code:
CKEDITOR.scriptLoader.load(
CKEDITOR.getUrl("lang/" + b + ".js"),
function () {
a(b, this[b])
},
this
)
The getUrl
fails miserabily to locate the file when in "production" mode because all javascript files are compacted into one big file by OpenERP webservice which url is http://myhost/web/webclient/js
. In debug mode, javascript files are uncompressed AND directly accessed through their own URL actually following the static
folder hierarchy (with URLs in the form: http://myhost/web_ckeditor/static/...
).
Executing CKEDITOR.getUrl("lang/")
:
This explains that b.lang
is probably defaulted to values not containing any contextmenu
attributes, and produces the Exception we are chasing.
I'm looking into the best options we have to tackle this bug.
To reproduce:
1 - Edit partner form or other form to use "ckeditor" widget in debug mode (with "?debug=" in URL) 2 - logout and login in normal mode (NOT debug mode) 3 - Try to edit a partner to see the ckeditor interface:
OpenERP spawns a Javascript Exception message:
On chrome: Uncaught TypeError: Cannot read property 'options' of undefined On firefox: TypeError: b.lang.contextmenu is undefined