Cannot read property 'getComputedStyle' of undefined ckeditor

。_饼干妹妹 提交于 2019-12-11 17:17:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!