PasteHTML doesnt work properly in IE7 when using the breakelement.BR

  •  07-28-2010, 2:25 PM

    PasteHTML doesnt work properly in IE7 when using the breakelement.BR

    Hi There,
     
    PasteHTML works fine in Firefox, however when you use PasteHTML in IE7, the pasted text is always after all the BR's in front of the next text.  Can someone please look into this, this is some critical functionality we are looking for.  The example below in IE7 causes the behavior.
     
    1. Use the code below.
    2. Put your cursor anywhere  in the middle between the start and end text.
    3. Click the insert text button.
    4. The code is pre-pended to the end text.
     
    --------------------------------------
    <%@ Page Language="VB" %>   
       
     <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>   
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
       
     <script runat="server">   
         
         Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
             
             If Page.IsPostBack = False Then
                 
                 FCKeditorKB2.AutoConfigure = AutoConfigure.Simple
                 FCKeditorKB2.BreakElement = BreakElement.Br
             
                 FCKeditorKB2.Text = "Start<br /><br /><br /><br /><br />End"
                 
             End If
             
         End Sub
         
         Protected Sub btnGo_Click(ByVal sender As Object, ByVal e As System.EventArgs)

         End Sub
         
    </script>   
       
     <html xmlns="http://www.w3.org/1999/xhtml">   
     <head id="Head1" runat="server">   
         <title>Untitled Page</title>  
        
        <LINK href="~/css/SOPHTrac.css" type="text/css" rel="stylesheet" />

     </head>   
     <body>   
         <form id="form1" runat="server">   
             <div>   
                 <asp:Button ID="btnGo" runat="server" Text="Insert Text" OnClick="btnGo_Click" OnClientClick="insertAtCursor_ActivityContent(this,'THIS IS INSERTED TEXT');" /><br />
                 <br />
                 <CE:Editor ID="FCKeditorKB2" runat="server" Width="275px" />   
             </div>   
         </form>   
     </body>   
     </html>   
     <script>   

       
    function insertAtCursor_ActivityContent(comingFrom, textToInsert) {
           
        //get editor
        var editor1 = document.getElementById('<%= FCKeditorKB2.ClientID %>');          

        //paste replace text in editor
        editor1.PasteHTML(textToInsert);   
       
    };
      
     </script> 
     --------------------------------------
     
    Thanks!
    Filed under:
View Complete Thread