Use jquery inside CKEditor plugin

谁说胖子不能爱 提交于 2019-12-24 11:49:12

问题


I'm trying to create a few ckeditor plugins that manipulate the a full html document's formatting (e.g. you push one of the editor's buttons and the selection becomes a callout, or moves to a new column). The CKEditor API isn't cutting it for me, so I'd like to use jquery on the editor's contents within the plugins. Any suggestions?

This is within Drupal using the wysiwyg plugin.


回答1:


I use JQuery in my plugins all the time and it works just like within a normal javascript file. I suggest that you load your editor in jquery's ready event, that at least makes sure that jquery is loaded.

Something like this should make sure that your plugins can use jquery because it's loaded beforehand.

<script type="text/javascript">
    $(document).ready(function () {
        CKEDITOR.replace( 'MyLittlePonyFanficEditorTextarea' );
    });
</script>


来源:https://stackoverflow.com/questions/13311983/use-jquery-inside-ckeditor-plugin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!