ForeColor tool

2 posts, 0 answers
  1. Kiran
    Kiran avatar
    4 posts
    Member since:
    Aug 2011

    Posted 20 Nov 2012 Link to this post

     Please tell me how to attach a handler to the ColorChange event of the ForeColor tool in Radeditor.
     The following script I have is not picking up the ForeColor tool using  $find(editor.get_id() + "_ForeColor");

    Also please let me know the event name corresponding to the color change. Is it add_colorChange?


     

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">

     </telerik:RadAjaxManager> 
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad" ToolsFile="~/Tools/ToolsFile.xml" Width="100%" Height="645"

     OnClientCommandExecuting="changeImageManager"  

    ContentFilters="RemoveScripts, FixUlBoldItalic, FixEnclosingP, IECleanAnchors, MozEmStrong, ConvertFontToSpan, IndentHTMLContent, EncodeScripts, OptimizeSpans, ConvertCharactersToEntities">

     <Content>  

    </Content>  

     

    </telerik:RadEditor

     

     

    <script type="text/javascript">  

     

    function OnClientLoad(editor) {

    var

    forePicker = $find(editor.get_id() + "_ForeColor");

    forePicker.add_colorChange(

    function(sender, args) { 

    var color = sender.get_selectedColor(); 

    sender.get_element().style.borderColor = color ? color : "transparent";

     editor.fire("ForeColor", { value: color });});
    }

     

     

    </script>

     

     

     

  2. Rumen
    Admin
    Rumen avatar
    14010 posts

    Posted 20 Nov 2012 Link to this post

    Hello,

    The OnClientLoad event is executed only when the editor is loaded on the page. You need to attach to the OnClientCommandExecuting which is fired when some command is executed. See this forum thread for more information: Add Custom Color.

    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top