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

[Solved] Controlling the font size of CodeBlock?

1 Answer 109 Views
Editor
This is a migrated thread and some comments may be shown as answers.
carlpro
Top achievements
Rank 1
carlpro asked on 24 Jun 2008, 11:01 PM
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

Sort by
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>


Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
carlpro
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or