开发者

jQuery: setting ckeditor baseurl

开发者 https://www.devze.com 2023-03-30 22:31 出处:网络
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.

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">
&lt;img src="intl/en_ALL/images/logo.gif" /&gt;
</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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号