Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nasty exception in "normal" mode when initializing a CKEDITOR instance. #2

Closed
vaab opened this issue Feb 22, 2013 · 2 comments
Closed
Assignees
Labels

Comments

@vaab
Copy link
Member

vaab commented Feb 22, 2013

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

@vaab
Copy link
Member Author

vaab commented Feb 22, 2013

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.

@vaab
Copy link
Member Author

vaab commented Feb 22, 2013

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.

@vaab vaab closed this as completed in 2794820 Feb 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant