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

Editor not showing default font details in Content property

3 Answers 122 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Silviu
Top achievements
Rank 1
Silviu asked on 13 Jan 2016, 03:43 PM

I have a RadEditor as can be seen below.

The default font seems to be Arial and size 14. Then I paste some plain text in the editor and yet when I check the txtDescription.Content property the text does not have any font name/size details.

If I were to change the font/size to anything other than the default values the .Content property contains <span font:... etc which is what I need.

How can I get this CSS formatting included even with the default font name and size?

 

<telerik:RadEditor ID="txtDescription" runat="server" Skin="Metro" Width="900px" EditModes="Design"
                               ContentAreaMode="Div" NewLineMode="Br" NewLineBr="true" EnableAjaxSkinRendering="False" Height="200px" OnClientLoad="RadEditorLoad">
                                <Tools>
                                    <telerik:EditorToolGroup Tag="MainToolbar">
                                        <telerik:EditorTool Name="SelectAll" ShortCut="CTRL+A / CMD+A" />
                                        <telerik:EditorTool Name="Cut" ShortCut="CTRL+X / CMD+X" />
                                        <telerik:EditorTool Name="Copy" ShortCut="CTRL+C / CMD+C" />
                                        <telerik:EditorTool Name="Paste" ShortCut="CTRL+V / CMD+V" />
                                        <telerik:EditorToolStrip Name="PasteStrip">
                                            <telerik:EditorTool Name="PasteFromWord" />
                                            <telerik:EditorTool Name="PasteFromWordNoFontsNoSizes" />
                                            <telerik:EditorTool Name="PastePlainText" />
                                        </telerik:EditorToolStrip>
                                        <telerik:EditorSeparator />
                                        <telerik:EditorSplitButton Name="Undo">
                                        </telerik:EditorSplitButton>
                                        <telerik:EditorSplitButton Name="Redo">
                                        </telerik:EditorSplitButton>
                                    </telerik:EditorToolGroup>
                                    <telerik:EditorToolGroup>
                                        <telerik:EditorTool Name="Superscript" />
                                        <telerik:EditorTool Name="Subscript" />
                                        <telerik:EditorTool Name="InsertParagraph" />
                                        <telerik:EditorTool Name="InsertGroupbox" />
                                        <telerik:EditorTool Name="InsertHorizontalRule" />
                                        <telerik:EditorTool Name="InsertDate" />
                                        <telerik:EditorTool Name="InsertTime" />
                                        <telerik:EditorSeparator />
                                    </telerik:EditorToolGroup>
                                    <telerik:EditorToolGroup>
                                        <telerik:EditorDropDown Name="FormatBlock">
                                        </telerik:EditorDropDown>
                                        <telerik:EditorDropDown Name="FontName">
                                        </telerik:EditorDropDown>
                                        <telerik:EditorDropDown Name="RealFontSize">
                                        </telerik:EditorDropDown>
                                    </telerik:EditorToolGroup>
                                    <telerik:EditorToolGroup>
                                        <telerik:EditorTool Name="AbsolutePosition" />
                                        <telerik:EditorSeparator />
                                        <telerik:EditorTool Name="Bold" ShortCut="CTRL+B / CMD+B" />
                                        <telerik:EditorTool Name="Italic" ShortCut="CTRL+I / CMD+I" />
                                        <telerik:EditorTool Name="Underline" ShortCut="CTRL+U / CMD+U" />
                                        <telerik:EditorTool Name="StrikeThrough" />
                                        <telerik:EditorSeparator />
                                        <telerik:EditorTool Name="JustifyLeft" />
                                        <telerik:EditorTool Name="JustifyCenter" />
                                        <telerik:EditorTool Name="JustifyRight" />
                                        <telerik:EditorTool Name="JustifyFull" />
                                        <telerik:EditorTool Name="JustifyNone" />
                                        <telerik:EditorSeparator />
                                        <telerik:EditorTool Name="Indent" />
                                        <telerik:EditorTool Name="Outdent" />
                                        <telerik:EditorSeparator />
                                        <telerik:EditorTool Name="InsertOrderedList" />
                                        <telerik:EditorTool Name="InsertUnorderedList" />
                                        <telerik:EditorSeparator />
                                    </telerik:EditorToolGroup>
                                    <telerik:EditorToolGroup>
                                        <telerik:EditorSplitButton Name="ForeColor">
                                        </telerik:EditorSplitButton>
                                        <telerik:EditorSplitButton Name="BackColor">
                                        </telerik:EditorSplitButton>
                                        <telerik:EditorSplitButton Name="InsertSymbol">
                                        </telerik:EditorSplitButton>
                                        <telerik:EditorTool Name="ConvertToLower" />
                                        <telerik:EditorTool Name="ConvertToUpper" />
                                    </telerik:EditorToolGroup>
                                </Tools>
                                <Content>
                                </Content>
                                <TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
                            </telerik:RadEditor>

3 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 15 Jan 2016, 09:23 AM
Hello Silviu,

Adding CSS file in the CssFiles collection is meant to be referenced only in RadEditor. On the server, there is no built-in utility to append the default style decorations. 

If the case is to add all default styles as inline ones, you can see if the suggestion in this thread—http://www.telerik.com/forums/radeditor-for-html-emails#Q1a4MHKVKUGammALwYxR-g—can help you out.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Silviu
Top achievements
Rank 1
answered on 15 Jan 2016, 12:03 PM

Hi Ianko,

 Thank you for the above, but are you saying that there is no property of RadEditor which can give me the HTML of the content?

When toggling to HTML mode from Design, all the HTML markup is being displayed, so how can I access that natively?

0
Ianko
Telerik team
answered on 15 Jan 2016, 12:41 PM
Hi Silviu,

The .Content property gives you the HTML content. But it is returned with only the inline styles, no default font name or size is included in the returned HTML. 

When switching from Design to HTML, the value shown is the innerHTML of the body. On the server, the same value is returned by the .Content property.

Could you please clarify which default name and size are you referring to in your original question?

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Editor
Asked by
Silviu
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Silviu
Top achievements
Rank 1
Share this question
or