I want to use CKEditor.
我想用CKEditor。
I have currently install CKEditor using npm
我目前使用npm安装CKEditor
So it is installed in node_modules folder
所以它安装在node_modules文件夹中
My folder structure is like
我的文件夹结构就像
app --> index.js
app - > index.js
node_modules -->ckeditor -->...
node_modules - > ckeditor - > ...
and I have required it in index.js
我在index.js中要求它
also set variable before initialization of library
在初始化库之前也设置变量
var CKEDITOR_BASEPATH = '../node_modules/ckeditor'
still getting the dir error
仍然得到dir错误
suggest some help
建议一些帮助
2 个解决方案
#1
3
Try changing
var CKEDITOR_BASEPATH = '../node_modules/ckeditor';
to
window.CKEDITOR_BASEPATH = '../node_modules/ckeditor/';
Don't forget the trailing slash on the directory
不要忘记目录上的尾部斜杠
And try putting the window declaration above your import of ckeditor
并尝试将窗口声明放在导入ckeditor之上
Check out this link for more information: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Specifying_the_Editor_Path
有关更多信息,请查看此链接:http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Specifying_the_Editor_Path
#2
0
NoToBagels fixed one of my problems. I also had the variable being set in jQuery doc ready which was registering CKEDITOR_BASEPATH too late. Moving it to run as soon as the javascript file loaded solved the issue.
NoToBagels解决了我的一个问题。我也在jQuery doc ready中设置了变量,这个变量很晚就注册了CKEDITOR_BASEPATH。加载javascript文件解决问题后立即运行它。
#1
3
Try changing
var CKEDITOR_BASEPATH = '../node_modules/ckeditor';
to
window.CKEDITOR_BASEPATH = '../node_modules/ckeditor/';
Don't forget the trailing slash on the directory
不要忘记目录上的尾部斜杠
And try putting the window declaration above your import of ckeditor
并尝试将窗口声明放在导入ckeditor之上
Check out this link for more information: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Specifying_the_Editor_Path
有关更多信息,请查看此链接:http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Specifying_the_Editor_Path
#2
0
NoToBagels fixed one of my problems. I also had the variable being set in jQuery doc ready which was registering CKEDITOR_BASEPATH too late. Moving it to run as soon as the javascript file loaded solved the issue.
NoToBagels解决了我的一个问题。我也在jQuery doc ready中设置了变量,这个变量很晚就注册了CKEDITOR_BASEPATH。加载javascript文件解决问题后立即运行它。