CKEditor does not render in Chrome
背景:我正在构建一个博客应用程序,其中的博客内容textarea字段将替换为CKEditor。
问题:在Chrome中加载网页后,在禁用文本区域的情况下出现以下错误。
"未捕获的TypeError:无法读取未定义的属性'getComputedStyle'"
代码:
Javascript:
1 2 3 4 | $(document).ready(function() { CKEDITOR.addCss('body {font-family:"Roboto","Helvetica","Arial", sans-serif;}'); var contentEditor = CKEDITOR.replace( 'blogContent' ); }); |
HTML:
1 2 3 4 5 6 7 | <body> <textarea type="text" rows="10" name="blogContent" id="blogContent" maxlength="2000"></textarea> <script src="//cdn.ckeditor.com/4.9.2/standard/ckeditor.js"> <script src="/js/blog-form.js"> </body> |
版本:
Chrome:版本66.0.3359.139(正式版本)(64位)
CKEditor:4.9.2
我正在寻求帮助来解决此问题。在其他浏览器-Edge和Firefox中不会出现此问题。
运行此代码,即可在chrome上运行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> <script src="https://cdn.ckeditor.com/4.9.2/standard/ckeditor.js"> $(document).ready(function(){ CKEDITOR.addCss('body {font-family:"Roboto","Helvetica","Arial", sans-serif;}'); var contentEditor = CKEDITOR.replace( 'blogContent' ); }); </head> <body> <textarea type="text" rows="10" name="blogContent" id="blogContent" maxlength="2000"></textarea> </body> </html> |