Removing forecolour of backcolour from selection

2 posts, 0 answers
  1. Datamex
    Datamex avatar
    161 posts
    Member since:
    Jun 2012

    Posted 19 Aug 2009 Link to this post

    Hi,

    I have multiple RadEditors in the CMS of a webshop, with which it is possible to change different texts on the webshop. I added the tools for changing the fore- and backcolour of the text. This works as expected, except when you want to remove the colouring (and go back to the default colour, as specified in the css file). The colour controls have an "empty" colour in their top left, which shows as black on white in the two bars below the colourpicker. But somehow the text itself does not change colour. This problem also exists in the demo.

    Any help is appreciated.
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 24 Aug 2009 Link to this post

    Hi Datamex,

    I was able to reproduce this problem in Firefox only.

    Please, try the following code that will solve the issue in Firefox:

    <script type="text/javascript">   
    function OnClientCommandExecuted(editor, args)   
    {   
       if (!args || !args.get_commandName) return;                             
       var command = args.get_commandName();  
       var value = args.get_value();  
         
       if (command == "ForeColor" || command == "BackColor")  
       {  
           if ($telerik.isIE) return
           if (value.trim() == "")  
           {  
             editor.get_document().execCommand("RemoveFormat"nullnull);  
             editor.fire("FormatStripper", {value : "SPAN"});   
       
           }  
       }  
    }  
    </script>   
       
    <telerik:radeditor   
       runat="server"   
       ID="RadEditor1"   
       OnClientCommandExecuted="OnClientCommandExecuted" >   
       <Content> sample content </Content>   
    </telerik:radeditor>   


    Best wishes,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top