Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

javascript - How do you define the path which CKEditor uses to search for config / language files?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...