This is a migrated thread and some comments may be shown as answers.
Maintain text format settings
1 Answer 13 Views
This is a migrated thread and some comments may be shown as answers.
Filipe Peixinho
Top achievements
Rank 1
Filipe Peixinho asked on 12 Sep 2011, 11:12 AM
Greetings,

I have developed a chat app using RadEditor to type in the messages.
I have also used the text formating capabilities from rad editor to enhance the chat, but now i'm having some technical dificulties. I want the radEditor to preserve the formating settings when i change the cursor position or when i clean/insert HTML content to the RadEditor.

Is there a way to always keep the text formatting setting unless the user changes them?
I'm just using the Italic,Bold,Underline and text-color.

Any kind of help would be useful!

1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 13 Sep 2011, 02:27 PM
Hello Filipe,

RadEditor is more similar to MS Word and does not offer the requested functionality out-of-the box. If you would like you can use the OnClientCommandExecuted event to obtain the selected values from the different formatting tools and store them in some global variables. After that in the OnClientSelectionChange event to apply the value of these variable when start typing in the content area.

The implementation of the requested custom functionality will be not easy because the different browsers have their own implementation of the text range object. RadEditorSelection utilizes W3C Range and Microsoft TextRange objects to provide cross-browser support, however, for more advanced manipulations you will need to use the standard objects. More detailed information regarding W3C Range and Microsoft TextRange is available in the following articles:

http://www.wrox.com/WileyCDA/Section/JavaScript-DOM-Ranges-Page-2.id-292302.html
http://www.quirksmode.org/dom/range_intro.html
http://msdn.microsoft.com/en-us/library/ms535872%28VS.85%29.aspx

http://www.quirksmode.org/js/findpos.html



Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Filipe Peixinho
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or