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

To prevent replcement of every space with   and to insert nonbreaking space by Ctrl+Shift+Space through RadEditor

1 Answer 105 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Prajna
Top achievements
Rank 1
Prajna asked on 03 Jan 2014, 06:37 AM
Hi,

I want some solution that would handle all the three scenarios mentioned below.
Scenario 1:
I am using Content property of RadEditor to get values entered by the user in the RadEditor control. However, I see that every space in the value entered by user is getting converted to  . For example, if user has entered the value as - 'Hi Hello' in the editor, the value we get from RadEditor1.Content is  - 'Hi Hello'. I don't want this to happen.

Scenario 2:
Also, my requirement is that in the same editor the user should be able to insert nonbreaking space by Ctrl+Shift+Space. For example, if the user types 'Hi(Ctrl+Shift+Space)Hello' we must get the value as 'Hi Hello'.

Scenario 3:
Also, if user manually types   in the editor, it should be retained as it is and should not get replaced with space.

I tried using Text property of RadEditor. But it handles only first scenario mentioned and considers Ctrl+Shift+Space as normal space and not as  

Answer through sample code would be helpful.

Thanks,
Prajna

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 07 Jan 2014, 10:48 AM
Hello Prajna,

The described behavior of the white space is the same as you require. Could you please test the scenarios with this online demo and let me know if I am somehow mislead on the case.

About the Ctrl+Shift+Space shortcut, it is implemented only in IE and we do not interfere with the non-breaking space inserted. Also I can see that the inserted symbol is an   entity as you desire.

If the case is that you want to have the same functionality under other browsers you can create an invisible custom tool, set with the desired shortcut, which implements the desired logic. You can examine this example setup for such tool:
<telerik:RadEditor runat="server" ID="RadEditor1">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="CustomBtn" ShortCut="CTRL+SHIFT+SPACE" Visible="false"/>
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>
 
<script type="text/javascript">
    Telerik.Web.UI.Editor.CommandList["CustomBtn"] = function (commandName, editor, args) {
        if (!$telerik.isIE) {
            editor.pasteHtml("&nbsp;");
        }
    };
</script>

 
Regards,
Ianko
Telerik
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 the blog feed now.
Tags
Editor
Asked by
Prajna
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or