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

ForeColor tool

1 Answer 52 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 1
Kiran asked on 20 Nov 2012, 06:22 AM
 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>

 

 

 

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 20 Nov 2012, 03:25 PM
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.
Tags
Editor
Asked by
Kiran
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or