Angular6中的Ckeditor“ c [a]未定义”

时间:2018-11-30 13:13:50

标签: javascript angular ckeditor ckeditor4.x

原始文档说您需要添加

<script src="https://cdn.ckeditor.com/4.5.11/full/ckeditor.js"></script>

到index.html(https://www.npmjs.com/package/ng2-ckeditor)。 问题是我不能在项目中具有外部依赖项。

下一步,我尝试添加

 <script src="../node_modules/ckeditor/ckeditor.js"></script>

但是在ng build --prod(使用nginx)之后这将不起作用

最后一步,我尝试添加“ node_modules / ckeditor / ckeditor.js” 如下所示的angular.json脚本:

 "scripts": [
             //some other scripts,
              "node_modules/ckeditor/ckeditor.js"
            ]

部分,但是现在我得到了

  

在浏览器的控制台中,“ ERROR TypeError:“ c [a]未定义”。

独立性版本为: ckeditor:^ 4.9.2和ng2-ckeditor:^ 1.2.1

在不调用cdn.ckeditor.com的情况下包含ckeditor.js的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

我已经通过将编辑器更新到版本5来解决此问题。没有一个不需要加载脚本了。