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

RealFont Size In Points(pt)

1 Answer 85 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Arjun
Top achievements
Rank 1
Arjun asked on 11 Oct 2012, 05:23 PM
Hi ,

I have a requirement to show realfont sizes in pt.  I used the trick already mentioned in many other threads:-

function OnClientSelectionChange(editor, args) {
 
 
    var tool = editor.getToolByName("RealFontSize");
    if (tool ) {
        setTimeout(function () {
            debugger;
            var value = tool.get_value(); 
            if (!value || value.indexOf('pt') >= 0)
                return;
            value.replace('px''');
            var newSize = parseInt(value) * 0.75;
            if (newSize.toString().indexOf('.25') >= 0) {
                newSize -= 0.25;
            } else if (newSize.toString().indexOf('.75') >= 0) {
                newSize += 0.25;
            }
            tool.set_value(newSize + 'pt');
        }, 0);
    }
}


The problem comes when i use style builder over some text and set the font size to some other metric say cm/mm. i don't see the converted value in pt in the real font size dropdown in pt. this works fine in Chrome and Firefox but on in IE.

I am using radeditor in ribbonbar mode. Is there a way to fix this.

Thanks,
AM

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 12 Oct 2012, 01:47 PM
Hi,

You can try one of the following options:
-  Customize the StyleBuilder.ascx file and remove the unwanted font size values.
- or attach to the OnClientPasteHtml event and modify the inserted HTML by the StyleBuilder:

<script type="text/javascript">
    function OnClientPasteHtml(sender, args) {
        var commandName = args.get_commandName();
        var value = args.get_value();
 
        if (commandName == "StyleBuilder") {
            alert(value);
            args.set_value(value);
        }
    }
</script>
<telerik:RadEditor runat="server" OnClientPasteHtml="OnClientPasteHtml" ImageManager-ViewPaths="~/"
    ID="RadEditor1">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="StyleBuilder" />
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>


All the best,
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
Arjun
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or