Hello,

I have a site where CKEditor does not initially load. However, if i switch to plain text editor then back to rich text editor it displays. I suppose the issue has to do with this error I see in the inspector consoles.

Chrome inspector is = Uncaught TypeError: Cannot read property 'hasAttribute' of undefined
Firefox and Firebug inspectors = TypeError: a.element is undefined

Any idea how I can remedy that? Thanks for the terrific module. Cheers Kevin

Comments

ZalemCitizen’s picture

Same problem here in administration forms.

The error occurs in the line CKEDITOR.ELEMENT_MODE_REPLACE && a.element.hasAttribute("disabled"))); within this function of ckeditor.js :

function g(a, b) {
                a.on("customConfigLoaded", function() {
                    if (b) {
                        if (b.on)
                            for (var c in b.on) a.on(c, b.on[c]);
                        CKEDITOR.tools.extend(a.config, b, true);
                        delete a.config.on
                    }
                    c = a.config;
                    a.readOnly = !(!c.readOnly && !(a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? a.element.is("textarea") ? a.element.hasAttribute("disabled") : a.element.isReadOnly() : a.elementMode ==
                        CKEDITOR.ELEMENT_MODE_REPLACE && a.element.hasAttribute("disabled")));
                    a.blockless = a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? !(a.element.is("textarea") || CKEDITOR.dtd[a.element.getName()].p) : false;
                    a.tabIndex = c.tabIndex || a.element && a.element.getAttribute("tabindex") || 0;
                    a.activeEnterMode = a.enterMode = a.blockless ? CKEDITOR.ENTER_BR : c.enterMode;
                    a.activeShiftEnterMode = a.shiftEnterMode = a.blockless ? CKEDITOR.ENTER_BR : c.shiftEnterMode;
                    if (c.skin) CKEDITOR.skinName = c.skin;
                    a.fireOnce("configLoaded");
                    a.dataProcessor =
                        new CKEDITOR.htmlDataProcessor(a);
                    a.filter = a.activeFilter = new CKEDITOR.filter(a);
                    i(a)
                });
                if (b && b.customConfig != void 0) a.config.customConfig = b.customConfig;
                c(a) || a.fireOnce("customConfigLoaded")
            }
ZalemCitizen’s picture

@drupalstrap :
In my case, I found that the JS of a custom module was loading in the administrative pages.
When excluding this, the error disappeared.

My JS is especially executing stuff in .ajaxSend and .ajaxComplete functions, which are called at every AJAX request.

Check if you don't have something alike.

FinderFees’s picture

I'm having the same issue. Will look into the suggestion in #2.

@drupalstrap - Did you find a different solution?

--

Edit: Never mind, my issue was with some custom js and css files for ckeditor that I didn't realize existed in some of the profiles. They were pointing to the wrong location. It must have worked when I switched to plain text and back because it would then grab a different profile without the css and js defined.