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

[Solved] Safari saves font colors differently

1 Answer 96 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matt O'Connor
Top achievements
Rank 1
Matt O'Connor asked on 02 Jun 2009, 08:03 PM
In the editor when changing font colors it works differently in Safari than it does in firefox. In FF it sets the color style to "color: #ffffff" but in Safari it stores it as "color: rgb(0,0,0)". My problem is that when I export this text to Word, the rbg color isn't being recognized by Word. How can I make safari always use the #FFFFF style?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 04 Jun 2009, 02:32 PM
Hi Matt,

You can use the code below to convert the RGB colors to HEX colors:

<telerik:RadEditor runat="server" ID="RadEditor1" > 
    <Content></Content> 
</telerik:RadEditor> 
<script type="text/javascript"
Telerik.Web.UI.Editor.ConvertToXhtmlFilter.prototype._convertRgbToHex = function(text) 
    { 
        if ($telerik.isFirefox || $telerik.isSafari) 
        { 
            var fixColorValue = $telerik._rgbToHex; //Telerik.Web.UI.Editor.ConvertFontToSpanFilter.prototype._fixColorValue; 
            text = text.replace(/rgb *\( *\d+ *, *\d+ *, *\d+ *\)/gi, function(match, offset, fullText) 
            { 
                return fixColorValue(match); 
            }); 
        } 
        return text; 
    } 
</script> 


Greetings,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Matt O'Connor
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or