How can I control the font size of the formated code returned from FormatCodeBlock?
It appears to be always setting the font-size to 11px.
e.g.
<span style="font-size: 11px">code</span>
1 Answer, 1 is accepted
0
Rumen
Telerik team
answered on 27 Jun 2008, 01:01 PM
Hi Carl,
You can controls the font size of the returned formatted code of the FormatCodeBlock dialog by attaching to the OnClientPasteHtml event of RadEditor and using a regular expression. Here is an example:
<script type="text/javascript">
function OnClientPasteHtml(sender, args)
{
var commandName = args.get_commandName();
var value = args.get_value();
if (commandName == "FormatCodeBlock")
{
alert(value);
value = value.replace(/11px/gi,"20px");
alert(value);
//Set new content to be pasted into the editor
args.set_value(value);
}
}
</script>
<telerik:RadEditor runat="server"
OnClientPasteHtml="OnClientPasteHtml"
ImageManager-ViewPaths="~/"
ID="RadEditor1">
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="FormatCodeBlock" />
</telerik:EditorToolGroup>
</Tools>
</telerik:RadEditor>