自定义控制(自定义表),将其拖动到radeditor [英] Custom control(custom table) and drag it on to radeditor

查看:161
本文介绍了自定义控制(自定义表),将其拖动到radeditor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计由具有HTML文本的自定义的控制,将其拖动到radeditor(如:拖放使用默认的CSS创建一个自定义表)

I want to design a custom control which is having html text and drag it on to radeditor(eg: drag and drop a custom table created with default css)

可我知道如何做到这一点?

May i know how to do this?

感谢

推荐答案

通过检查该开始看你怎么可以听编辑器内容区域放置事件,并使用其 pasteHtml ()方法添加你想要的内容:的http://demos.telerik.com/aspnet-ajax/editor/examples/treeviewandeditor/defaultcs.aspx

Start by examining this to see how you can listen to the drop event in the editor content area and use its pasteHtml() method to add the content you want: http://demos.telerik.com/aspnet-ajax/editor/examples/treeviewandeditor/defaultcs.aspx

如果没有控制,为您提供drop事件,则需要自行安装:的 http://www.telerik.com/help/aspnet-ajax/editor-attacheventhandler.html 。这里有一个例子:

Without a control to provide you the drop event, you need to attach it yourself: http://www.telerik.com/help/aspnet-ajax/editor-attacheventhandler.html. Here is a sample:

        <script type="text/javascript">
            function OnClientLoad(editor, args) {
                editor.attachEventHandler("drop", function (e) {
                    alert(e);
                                            editor.pasteHtml(e.srcElement.toString());
                });
            }
        </script>
        <telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
        </telerik:RadEditor>

所以,有了这个,你可以生成自己喜欢的内容。
注意:有些浏览器将自行处理拖放和添加元素含量

So, with this, you can generate the content you like. NOTE: some browser will handle drag and drop by themselves and add elements to the content.

另一种方法是创建一个自定义comamnd,将直接插入所需的HTML,如果它是静态的:的 http://www.telerik.com/help/aspnet-ajax/editor-adding-your-own-buttons.html

Another option is to create a custom comamnd that will directly insert your desired HTML if it is static: http://www.telerik.com/help/aspnet-ajax/editor-adding-your-own-buttons.html.

这篇关于自定义控制(自定义表),将其拖动到radeditor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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