如何在选择dropdownItem时向ckeditor添加一个下拉/按钮来插入内容 [英] how to add a dropdown/button to ckeditor to insert content when selecting a dropdownItem

查看:238
本文介绍了如何在选择dropdownItem时向ckeditor添加一个下拉/按钮来插入内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够添加一个下拉菜单或按钮到ckeditor的工具栏,将弹出一个列表,当listitem将被点击该列表项的文本将被添加到ckeditor的内容



我还需要能够改变列表的内容,比如有一个函数:

  function SetListsContent(arr)
{
//用数组填充数组arr
...
}


解决方案

我最后这样做:

 < div id ='stuff'> 
< ul class =editorlist>
< li> hi< / li>
< li>您好!< / li>
< li>好< / li>
< / ul>
< / div>

< script type ='text / javascript'>
function myfunc(){
$('< a href =#id =stuffadd>添加一些文本< / a>')
。 {$('#stuff')。dialog('open');})。appendTo('。cke_button:last');
}
< / script>


I need to be able to add a dropdown or button to the ckeditor's toolbar that will pop up a list, and when a listitem would be clicked the text of that list item would be added to the ckeditor's content

I also need to be ablee to change the content of that list, like to have a function:

function SetListsContent(arr)
{
//fill the list with the array arr
...
}

解决方案

I end up doing this:

<div id='stuff'>
    <ul class="editorlist">
        <li>hi</li>
        <li>how are you</li>
        <li>good</li>
    </ul>
</div>

<script type='text/javascript'>
    function myfunc() {
        $('<a href="#" id="stuffadd">add some text</a>')
        .click(function () { $('#stuff').dialog('open'); }).appendTo('.cke_button:last'); 
    }
</script>

这篇关于如何在选择dropdownItem时向ckeditor添加一个下拉/按钮来插入内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆