问题
I use ckeditor on my website, and from time to time when I load my page I get this error which blocks the ckeditor:
"Cannot read property 'getComputedStyle' of undefined ckeditor"
Here's the code that initializes the ckeditor :
CKEDITOR.replace('TA_comments', {
toolbar: 'MyToolbar_user',
on: {
'instanceReady': function (evt) {
//Set the focus to your editor
CKEDITOR.instances.TA_comments.focus();
}
}
});
Any idea where it can come because it's really a random problem on all browsers?
Thanks !
回答1:
I was getting a similar error and it was caused by calling $('#id').empty(); Followed the ideas in this post:
How do I clear the contents of a div without innerHTML = "";
and used this code:
var node = document.getElementById('id');
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
回答2:
I found the problem. It was a problem with a jquery plugin mscustomscrollbar. To resolve this I deleted the plugin and used css3 to style scrollbar.
回答3:
I Had the same problem. My solution was: Client was using adblock pro, and I found out that in adblock our page that is using ckeditor is blocked! Removed our page from adbblock and it works fine now!
来源:https://stackoverflow.com/questions/24178904/cannot-read-property-getcomputedstyle-of-undefined-ckeditor