Editor lost spaces on paste

6 posts, 0 answers
  1. cglubish
    cglubish avatar
    11 posts
    Member since:
    Aug 2012

    Posted 10 May 2012 Link to this post

    Since upgrading to the latest build we are having a problem with content pasted in.  Spaces seem to be randomly removed.

    The problem can be duplicated in your demos.  

    Chrome V18.0.1025.168 m USING Telerik.Web.UI_2012_1_411

    If I copy paste the the following text (which was copy/pasted from a word doc):

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec elementum vehicula condimentum. Vivamus sed neque arcu. Proin mattis tristique ante, ac tincidunt sem vulputate sed. Vestibulum et elit ac lorem sagittis blandit a vitae dui. Sed aliquet fermentum pulvinar. Nunc erat ante, euismod sit amet blandit pulvinar, semper sed orci. Pellentesque egestas tempus magna, vitae interdum dui feugiat a. Duis a vestibulum arcu. Nam arcu turpis, fringilla in consectetur pulvinar, hendrerit sed sem. Phasellus id sem odio. Nam quis ante lectus. In non sapien vitae turpis pulvinar congue. Ut porta auctor nisl non hendrerit. Proin eget odio at nibh faucibus laoreet.

     


    If I paste it into my editor (or the demo @ http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx) it randomly removes spaces, notably in my example between the words "Donec elementum vehicula" near the beginning.  It turns to "Donec elementumvehicula"

    The editor on your demo asks me if I want to "clean word formatting".  If I say yes, the spacing problem exists.  If I say cancel, it pastes it preserving the spaces. If I copy/paste from the forum, or from another website it works fine.  Its just when copy/pasting from Outlook/Word.  

    I noticed the problem doesn't seem to happen in the forum editor.  I couldn't duplicate it here, but could in the demo.  In our app, if we revert to the last build, the problem goes away. 

  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 15 May 2012 Link to this post

    Hello,

    Thank you for reporting this problem.

    I was able to reproduce it and logged it for fixing in our bug tracking system. You can see the PITS item here and vote for it. I also updated your Telerik points for your bug report.

    Please, excuse us for the temporary inconvenience that this bug is causing.

    All the best,
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Xander
    Xander avatar
    15 posts
    Member since:
    Dec 2005

    Posted 15 May 2012 Link to this post

    I voted for it on PITS.

    I hope they fix this soon. Right now the editor can't be used, if users cannot paste something.
  5. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 17 May 2012 Link to this post

    Hello,

    The problem is escalated to our developers and its priority is top. We will do our best to fix it for the upcoming Q2 2012 release, scheduled for the beginning of June.

    Kind regards,
    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.
  6. Alan
    Alan avatar
    2 posts
    Member since:
    Nov 2010

    Posted 10 Oct 2013 Link to this post

    We're getting this issue in IE10 on version 2012.1.411.35, which seems to be the latest version of the 2012 release we're licensed for (we haven't upgraded to 2013). Is upgrading the only solution?
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 11 Oct 2013 Link to this post

    Hi Alan,

    I would strongly advise on upgrading, you can see my reply to a very similar thread here: http://www.telerik.com/community/forums/aspnet-ajax/editor/problem-with-stripformattingoptions.aspx.

    If this is not an option you can try placing the following script override just before the closing </form> tag, although I cannot guarantee things will work as expected, because of the complexity of the function:
    <script type="text/javascript">
        Telerik.Web.UI.Editor.Utils.stripWordFormatting = function (html, clearValue) {
            var htmlText = html;
            if (clearValue == "WORD_ALL") {
                var spanCleaner = /<SPAN[^>]*?>([\s\S]*?)<\/SPAN[^>]*?>/ig;
                while (htmlText.match(spanCleaner)) {
                    htmlText = htmlText.replace(spanCleaner, "$1");
                }
                var fontCleaner = /<FONT[^>]*?>([\s\S]*?)<\/FONT[^>]*?>/ig;
                while (htmlText.match(fontCleaner)) {
                    htmlText = htmlText.replace(fontCleaner, "$1");
                }
            }
            htmlText = htmlText.replace(/<span>([^<>]+)<\/span>/gi, "<span EditorSaved='true'>$1</span>");
            htmlText = htmlText.replace(/<font>([^<>]+)<\/font>/gi, "<font EditorSaved='true'>$1</font>");
            if ($telerik.isFirefox) {
                htmlText = htmlText.replace(/<(?:link|meta) [^>]+>/ig, "");
                htmlText = htmlText.replace(/<!--\[if [^\]]+]>[\s\S]+?<!\[endif\]-->/ig, "");
                htmlText = htmlText.replace(/<style[^>]*?>[\s\S]*?<\/style>/ig, "");
            }
            htmlText = htmlText.replace(/[\u000a\u000d]/ig, ' ');
            htmlText = htmlText.replace(/<o:p> <\/o:p>/gi, '');
            htmlText = htmlText.replace(/<\/?o:[^>]*>/gi, "");
            htmlText = htmlText.replace(/ class=\"(mso[^\"]*)\"/gi, "");
            htmlText = htmlText.replace(/ class=(mso\w+)/gi, "");
            htmlText = htmlText.replace(/<!--[\s\S]+?-->/gi, "");
            htmlText = htmlText.replace(/<\\?\?xml[^>]*>/gi, "");
            htmlText = htmlText.replace(/^(?:\s| )+/i, '');
            htmlText = htmlText.replace(/(?:\s| )+$/i, '');
            var htmlContainer = document.createElement("div");
            Telerik.Web.UI.Editor.Utils.setElementInnerHtml(htmlContainer, htmlText);
            this.clearWordAttributesInElement(htmlContainer, clearValue);
            htmlText = htmlContainer.innerHTML;
            htmlText = htmlText.replace(/\t/g, ' ');
            htmlText = htmlText.replace(/<\/?\w+:[^>]*>/gi, '');
            htmlText = htmlText.replace(/<\\?\??xml[^>]>/gi, '');
            htmlText = htmlText.replace(/<p> <\/p>/gi, '<BR><BR>');
            htmlText = htmlText.replace(/[ ]+/g, ' ');
            htmlText = htmlText.replace(/<st1:.*?>/gi, '');
            htmlText = htmlText.replace(/<font>([^<>]+)<\/font>/gi, '$1');
            htmlText = htmlText.replace(/<span>([^<>]+)<\/span>/gi, '$1');
            htmlText = htmlText.replace(/[\s]+EditorSaved=[\'\"]true[\'\"]/gi, "");
            htmlText = this.cleanStylesOnStripWordFormatting(htmlText);
            htmlText = htmlText.replace(/style=(""|'')/ig, "");
            htmlText = htmlText.replace(/class=(""|'')/ig, "");
            htmlText = htmlText.replace(/v:shape="[^"]+"/ig, "");
            htmlText = htmlText.replace(/<span[^>]*>\s*<\/span[^>]*>/ig, " ");
            htmlText = htmlText.replace(/<font[^>]*>\s*<\/font[^>]*>/ig, " ");
            htmlText = htmlText.replace(/\s+/ig, " ");
            return htmlText;
        }
    </script>


    Regards,
    Marin Bratanov
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017