i'm using ckEditor together with its own jQuery adapter and i'd like to define the editor's baseUrl in order that it will show images in the html.
here's my code - unfortunately doesnt work:
var txt = $("textarea");
txt.ckeditor();
var editor = txt.c开发者_JAVA技巧keditorGet();
editor.baseurl = "/myweb1/test/";
any ideas what's wrong?
thanks
The configuration property which you are looking for is actually ckeditor.config.baseHref
You can pass in configuration options through the ckeditor() initializer like this:
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$( 'textarea' ).ckeditor({baseHref : "http://www.google.com/"});
});
</script>
</head>
<body>
<textarea cols="80" id="editor1" name="editor1" rows="10">
<img src="intl/en_ALL/images/logo.gif" />
</textarea>
</body>
</html>
You can also do it more dynamically like so:
txt = $( 'textarea' ).ckeditor();
txt.ckeditorGet().config.baseHref="http://www.google.com/"
Some more info can be found here - http://ckeditor.com/blog/CKEditor_for_jQuery
精彩评论