最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - CKEditor works - but get error "Uncaught ReferenceError: CKEDITOR is not defined" - Stack Overflo

programmeradmin3浏览0评论

I have an inline CKeditor on my page and it works fine. It posts AJAX after its been updated, all works great.

However, in the console I get the error "Uncaught ReferenceError: CKEDITOR is not defined"

I discovered this when I was trying to modify the toolbar in the javascript, but the toolbar wasn't changing.

Any ideas what is going on here?

<div id="editor<?php echo $sub_category['id'] ?>" contenteditable="true" class="contentz ckeditor" typeID="<?php echo $sub_category['id'] ?>">
<?php if($sub_category['content']==""){ echo "Click here to add some content"; }else{ echo $sub_category['content']; } ?>
</div>
<script>

    // Turn off automatic editor creation first.
    CKEDITOR.disableAutoInline = true;
    CKEDITOR.inline('editor<?php echo $sub_category['id'] ?>');



</script>

This is called just before the body tag...

<script src="assets/js/ckeditor/ckeditor.js"></script>
<script src="assets/js/ckeditor/adapters/jquery.js"></script>

I have an inline CKeditor on my page and it works fine. It posts AJAX after its been updated, all works great.

However, in the console I get the error "Uncaught ReferenceError: CKEDITOR is not defined"

I discovered this when I was trying to modify the toolbar in the javascript, but the toolbar wasn't changing.

Any ideas what is going on here?

<div id="editor<?php echo $sub_category['id'] ?>" contenteditable="true" class="contentz ckeditor" typeID="<?php echo $sub_category['id'] ?>">
<?php if($sub_category['content']==""){ echo "Click here to add some content"; }else{ echo $sub_category['content']; } ?>
</div>
<script>

    // Turn off automatic editor creation first.
    CKEDITOR.disableAutoInline = true;
    CKEDITOR.inline('editor<?php echo $sub_category['id'] ?>');



</script>

This is called just before the body tag...

<script src="assets/js/ckeditor/ckeditor.js"></script>
<script src="assets/js/ckeditor/adapters/jquery.js"></script>
Share Improve this question asked Oct 14, 2015 at 11:39 user3274489user3274489 3042 gold badges5 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

Move

<script>
    CKEDITOR.disableAutoInline = true;
    CKEDITOR.inline('editor<?php echo $sub_category['id'] ?>');
</script>

after

<script src="assets/js/ckeditor/adapters/jquery.js"></script>

because you must load ckeditor.js library first and then configure it with CKEDITOR methods/properties

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论