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

Setting foreground color to black does not add style

2 Answers 65 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 06 Sep 2013, 03:37 PM
When I use the foreground color picker to change a section of text to black, it does not add a span tag with the color set to #000000. Any other color does this. This is a problem because we may have a page where the default text color is not black and the user may want to change all or some of the text in the editor to black. I confirmed that it works this way in your demos. Is there no way to set the color to black other than going into html source mode and manually changing it yourself?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 11 Sep 2013, 11:20 AM
Hello Michael,

The described problem is encountered because the browser's default value of the color is the same as the desired one (#00000). After triggering the tool with this value, the browser does not create modifications to the elements, because the value is already set.

You could use the following setup to modify the arguments of the functionality and set a black color with slightly different HEX code:
<telerik:RadEditor runat="server" ID="RadEditor1"
OnClientCommandExecuting="OnClientCommandExecuting"></telerik:RadEditor>
<script>
function OnClientCommandExecuting(editor, args)
{
    if (args.get_commandName() === "ForeColor")
    {
        var value = args.get_value() === "#000000" ? "#000001" :  args.get_value();
        args.set_value(value);
    }
}
</script>
 
Regards,
Ianko
Telerik
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 the blog feed now.
0
Mike
Top achievements
Rank 1
answered on 11 Sep 2013, 04:24 PM
Hi Ianko,

It looks like that solves my problem.

Thanks very much,

Mike
Tags
Editor
Asked by
Mike
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Mike
Top achievements
Rank 1
Share this question
or