This is a migrated thread and some comments may be shown as answers.

How can I attach InsertSymbol event on RadToolBarButton

1 Answer 55 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 21 Mar 2010, 10:04 PM
Hi

I just replicate some of the editor built-in functions to my top toolbar, most of them works fine. e.g. Bold, HR, but I cannot make "InsertSymbol","InsertTable", "StripAll" work.  If I use "editor.fire("StripAll")" I will receive "undefine xxxxxxx" error.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 24 Mar 2010, 01:41 PM
Hi Vincent,

The commands that you are referring to, are a bit more complex and require specific arguments passed along with the name to the editor.fire() method to be executed correctly.

The following example demonstrates implementation of custom tools to the RadEditor toolbar that executes mentioned commands:
<telerik:RadEditor ID="RadEditor1" runat="server">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="CustomStripAll" />
            <telerik:EditorTool Name="CustomInsertSymbolTradeMark" />
            <telerik:EditorTool Name="CustomInsertTable" />
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>
 
<script type="text/javascript">
    Telerik.Web.UI.Editor.CommandList["CustomStripAll"] = function(commandName, editor, args)
    {
        editor.fire("StripAll", args);
    }
    Telerik.Web.UI.Editor.CommandList["CustomInsertSymbolTradeMark"] = function(commandName, editor, args)
    {
        args.set_value("&#153;");
        editor.fire("InsertSymbol", args);
    }
    Telerik.Web.UI.Editor.CommandList["CustomInsertTable"] = function(commandName, editor, args)
    {
        args.set_value({rows: 3, cols: 3});
        editor.fire("InsertTable", args);
    }
</script>

I hope this helps.

Greetings,
Dobromir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Vincent
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or