FixRangePasteBug error in PasteHTML

  •  11-06-2013, 10:27 AM

    FixRangePasteBug error in PasteHTML

    Using the current asp.net demo version of CuteEditor, win8, IE10, vs2012.

     

    Example code:

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Cutest._Default" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <!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">

    <head runat="server">

      <title></title>

    </head>

    <body> 

       <form id="form1" runat="server">

        <div> 

         <CE:Editor id="Editor1" ThemeType="Custom" runat="server">      </CE:Editor>

        </div> 

       </form> 

    <input type="button" value="Test Paste" onclick="test()" />

    </body></html>

    <script type="text/javascript">  

    function test()  {    var ed = document.getElementById('<%= Editor1.ClientID%>');    

    ed.PasteHTML('this is a test');  }

    </script>

     

    Clicking the 'Test Paste' button to insert 'this is a test' into the document works until the editor is manually edited and then the following error occurs:

     

    Unhandled exception at line 3, column 155297 in eval code

    0x80004005 - JavaScript runtime error: Unspecified error. 

     

    The error is on the line Oxa.pasteHTML(FixRangePasteBug(Ox142));
     

    NB pressing backspace in here keeps messing up the html! (e.g. press space and backspace inserts '&amp;amp;lt;br&amp;amp;gt;'. I also had a lot of fun getting the above code to paste in properly as it removed all line breaks + the cursor kept jumping around all over the place. (made this post in FF 25.0)<br>

    Filed under: ,
View Complete Thread