Current status of the RadEditor with regard to Word formatted data?

4 posts, 0 answers
  1. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 21 May 2013 Link to this post

    For lack of a better question, what is the current status of RadEditor with regard to pasting in copied text from Word?  Currently at our shop we're running Office Professional Plus 2010.  (I am not talking about pasting images.  We learned that the hard way.)

    I'm afraid I can't be more precise but the problem is that on rare occasions, when a user pastes in text from Word (or apparently Outlook) something gets slightly corrupted and my program doesn't function exactly as I expect.  And of course we're using multiple browsers.

    To put it another way, what are the best practices with regard to the Editor settings and searching the content, once saved to a database varchar field?
  2. Niko
    Admin
    Niko avatar
    404 posts

    Posted 24 May 2013 Link to this post

    Hello Boris,

    With the last release of the RadControls for Ajax - Q1.2013, we have made great progress in stripping down and managing better the formatting of a pasted Word content. Please, check the numerous improvements we have done from our release notes - Regards,
    Niko
    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 their blog feed now.
  3. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 24 May 2013 Link to this post

    From what I've seen in my first reading, it's nice but it doesn't address certain real world problems.

    I'm designing an app that has to be used by a wide variety of people, some technical, some not so technical, and some just technical enough to be dangerous.

    As a designer I'm not looking to give them more bells and whistles.  In fact one of my first tasks was to strip down the editor to limit their options.  We wanted to give them a basic rich text editor.  We frankly did not anticipate Word/Outlook pasting problems.  What I'd like to see is a no-images option, at least until this whole image thing is more standardized across all major browsers.  

    In short, I'm looking for programmer options that will allow me to save users from themselves.
  4. Niko
    Admin
    Niko avatar
    404 posts

    Posted 29 May 2013 Link to this post

    Hello Boris,

    The settings around the Word formatting strip is not something that should be accessible to your end users. These are settings that are applied on the server or client-side and will be the same for all your end users. If you decide to expose any of them as options to your users, then indeed you should be very cautious how will this be accomplished and communicated to the end users.

    Pasting images is supported in Firefox by default and we have enable it in Chrome. You can prevent it in Chrome by overriding the supportsClipboardData function. See the code below.

    About Firefox, you can handle on OnClientPasteHtml event and check the pasted HTML for image in base64 format.
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientPasteHtml="OnClientPasteHtml">
    </telerik:RadEditor>
     
    <script type="text/javascript">
        Telerik.Web.UI.Editor.ClipboardImagesProvider.prototype.supportsClipboardData = function(event)
        {
            return false;
        }
     
        function OnClientPasteHtml(editor, args)
        {
            if (args.get_commandName() == "Paste")
            {
                var pastedHtml = args.get_value();
                if ($telerik.isFirefox && /^<img[^>]*>$/i.test(pastedHtml) &&
                    /data:image\/[a-z]{2,5};base64/i.test(pastedHtml))
                {
                    pastedHtml = "";
                }
                args.set_value(pastedHtml);
            }
        }
    </script>

    Note that simple drag and drop can not be prevented in Firefox.

    Hope this helps.

    Regards,
    Niko
    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 their blog feed now.
Back to Top