I need to supress few charecters while copying text from MS Word to RadEditor control

2 posts, 1 answers
  1. Atluri
    Atluri avatar
    1 posts
    Member since:
    Aug 2012

    Posted 17 Aug 2012 Link to this post

    I need to supress few charecters while copying text from MS Word to RadEditor control such as ' (single quote)  and " (Double quotes). Below is the example.
     

    Below employees are requested me at HR’s desk in

    “Chris”

    “Jhon”


    This is different from the radEditior text

    Below employees are requested me at HR's desk in

    "Chris"

    "Jhon"


    is there any way to replace\supress this type of data as well ?
    I have used reEditor.StripFormattingOptions = Telerik.Web.UI.EditorStripFormattingOptions.MSWordRemoveAll;
    but not helped.
  2. Answer
    Rumen
    Admin
    Rumen avatar
    14413 posts

    Posted 17 Aug 2012 Link to this post

    Hi,

    You can attach to the OnClientPasteHtml property of RadEditor and modify the pasted content when the Paste command is executed, e.g.

    <script type="text/javascript">
    function OnClientPasteHtml(sender, args)
    {
        var commandName = args.get_commandName();
        var value = args.get_value();
        
        if (commandName == "Paste")
        {
            re = /“/gi;
            re1 = /”/gi;
            value= valuereplace(re, "\"").replace(re1, "\"");


            args.set_value(value);  //set the modified content in the editor
        }
    }
    </script>

    Greetings,
    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.
Back to Top