如何定义CKEditor用于搜索配置/语言文件的路径? [英] How do you define the path which CKEditor uses to search for config / language files?
问题描述
CKEditor似乎寻找其相对于加载位置的配置文件,而不是ckeditor.js的位置。因此,在网页 http://www.example.com/articles/1 上加载CKEditor会导致它寻找语言 http://www.example.com/articles/1/lang/ 中的文件
配置文件包含baseHref的属性,但它不会影响编辑器资源本身。
如何设置CKEditor使用它自己的资源的路径?
你描述的行为是不正常的,CKEditor isn' t正确识别自己的文件夹,所以你应该在加载CKEditor之前设置一个 CKEDITOR_BASEPATH
变量。
以下简短评论: http:/ /docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.basePath ,但可能还有其他地方,其解释更好。
成功实施因此:
< script>
window.CKEDITOR_BASEPATH ='http://example.com/path/to/libs/ckeditor/';
< / script>
然后载入主要
ckeditor.js
脚本。请注意,您可以使用根相对路径。/ path / to / libs / ckeditor /
但相对路径不起作用。CKEditor seems to look for its configuration files relative to the location it was loaded from, not the location of ckeditor.js. So loading CKEditor on the page http://www.example.com/articles/1 causes it to look for the language files in http://www.example.com/articles/1/lang/
The config file contains an attribute for baseHref, but it doesn't affect the editor resources themselves.
How do I set the path which CKEditor uses for its own resources?
解决方案That behavior that you describe isn't normal, for some reason CKEditor isn't identifying properly its own folder so you should set a
CKEDITOR_BASEPATH
variable before loading CKEditor.It's briefly commented here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.basePath but there might be other places where it's explained better.
A successful implementation is therefore:
<script> window.CKEDITOR_BASEPATH = 'http://example.com/path/to/libs/ckeditor/'; </script>
Then load the main
ckeditor.js
script. Note you can use root-relative paths e.g./path/to/libs/ckeditor/
but relative paths do not work.这篇关于如何定义CKEditor用于搜索配置/语言文件的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!