Installing CKEditor with npm

旧巷老猫 提交于 2019-12-05 11:56:11

There is probably a problem with paths to those CKEditor dependencies. I'm not sure if you are using browserify or something different but for example in browserify using require('ckeditor') will result in ckeditor.js (bundled probably with other js files) file loading from same dir as your app.coffee file while CKEditor dependencies are in node_modules/ckeditor/ dir.

To tell CKEditor from which directory it should load its dependency you may use CKEDITOR_BASEPATH:

window.CKEDITOR_BASEPATH = 'node_modules/ckeditor/'
require('ckeditor')

You may see if there is a problem with loading those files using Network tab in Dev console (e.g. F12 in Chrome).

Note that it's not ideal solution for production environment because then you need node_modules folder on your server. You should probably consider moving only those dependencies to other folder during building/releasing process (and use CKEDITOR_BASEPATH as before with path to this production folder).

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