Problem with paste and IE9

6 posts, 0 answers
  1. Andreas
    Andreas avatar
    144 posts
    Member since:
    May 2008

    Posted 22 Mar 2012 Link to this post

    Hi,

    We have a RadEditor with AutoResizeHeight="true" that is located inside a outer div that has scroll.
    When the entire window is about the same size as the div (in our case the div is always resized with the window), the page scrolls away and content that were located above the editor is not visible anymore!
    In our case it is the outer div that handles the scroll, so we have set the page to not display scroll at all (overflow:none).

    A simplified example:
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test.aspx.vb" Inherits="WebApplication1.test" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" style="overflow: hidden">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="s" runat="server">
        </asp:ScriptManager>
        <div style="background-color: Red; color: White">
            Some other content!!!
        </div>
        <div style="width: 800px; height: 300px; overflow: auto; background-color: Black">
            <telerik:RadEditor ID="aa" runat="server" ContentAreaMode="Div" AutoResizeHeight="true">
            </telerik:RadEditor>
        </div>
        </form>
    </body>
    </html>

    In this simplified example I have hardcoded the div size, to simulate this behavior you have to resize the browser window to ~same size as the div.
    When doing this, first enter new-lines until there is a substantial scroll in the div, then paste some content last in the editor.
    When pasted you can notice that the text above the editor disappears, the entire page has scrolled instead of the div!!!

    I have only seen this behavior in IE9, and it is a kinda new thing, I have only tested with 2012 Q1 release where it happens, and 2011.2.915 release where it doesn't happen at all!
    It appears in both Div-mode and Iframe-mode...

    Regards
    Caesar

  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 27 Mar 2012 Link to this post

    Hi Caesar,

    The experienced issue is not directly related to RadEditor but is a default browser behavior - when an element is focused the browser is trying to display it in the viewable area forcing the parent elements to scroll if needed.

    To workaround this issue I would suggest you to handle the RadEditor's OnClientPasteHtml client-side event and reset the scroll of RadEditor wrapper's parents 0, e.g.:
    function editorPasteHtml(editor, args)
    {
        setTimeout(function () //set minor timeout to ensure that the borwser have changed the scroll
        {
            $("#editorWrapper").parents().each(function (index, elem)
            {
                $(elem).scrollTop(0);
            });
        }, 0);
    }

    I hope this helps.

    Greetings,
    Dobromir
    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. Andreas
    Andreas avatar
    144 posts
    Member since:
    May 2008

    Posted 27 Mar 2012 Link to this post

    Hi,

    Well that helps, funny thing is that in the 2011.2.915 release, this isn't needed, so something must have changed since that release with Telerik...

    Regards
    Caesar
  4. Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 30 Mar 2012 Link to this post

    Hello Caesar,

    There are improvements in the paste process and if you do not experience the problem with the latest version, you shouldn't use Dobromir's solution.


    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.
  5. Andreas
    Andreas avatar
    144 posts
    Member since:
    May 2008

    Posted 30 Mar 2012 Link to this post

    Hi,

    We are only experiencing the problem with the latest versions (2012.1.215 and 2012.1.327), no problems at all in the 2011.2.915 release...

    Regards
    Caesar
  6. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 04 Apr 2012 Link to this post

    Hi Caesar,

    In Q1 2012 we have made some changes on the Paste functionality of RadEditor causing similar issue with the previous versions of the control and this might be a side effect of these changes. I have logged this into our database and brought this case to the attention of the developers and we will investigate it further.

    For the time being, you can use the workaround that I have provided earlier in this thread if it is suitable for your scenario.

    All the best,
    Dobromir
    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