Extra processing before pasting

Last post 07-17-2008, 4:17 PM by Adam. 1 replies.
Sort Posts: Previous Next
  •  07-13-2008, 5:26 AM 42172

    Extra processing before pasting

    Hi
     
    I was wondering if I could trap and manipulate pasted text before in appears in the editor screen.  Long and short of it is, our application has a lot of different users in different environments pasting text mostly from MS Word that contains bullets and formatting, which they want to retain. I have set it to "pasteword" but when they paste, a number of things are different, such as extra <p>&nbsp;</p> added between paragraphs as well as <p></p>, where a backspace removes the <p>&nbsp;</p>, and while that looks good on the screen, it shows up without any paragraph spacing on the rtf (which I am using cute editor to produce). Another strange thing is if they paste in from word and the ctrl + A and Ctrl + X, then paste in again it places 3 new <p>&nbsp;</p> at the top of the document. 
     
    This means they have to do more formatting after each paste, which they are not happy about. They want to paste from Word and save and have it look the same, after the paste, and on the report which uses the rtf. This is a nightmare for our clients and consequently, us as a software provider. We have built a complete web app for school reporting widely in use in Victoria and we have spent more time on this issue alone!!!
     
    Anyway, if I could trap the text from the paste before it appears in the editor in and remove any characters that we determine should not be there that would be helpful. I just have not been able to find the properties or methods on the editor instance that will allow me to do this. Any help would be appreciated.
     
     
    Cheers
     

  •  07-17-2008, 4:17 PM 42321 in reply to 42172

    Re: Extra processing before pasting

    You need to Retrieve Data from the Clipboard first then use the editor1.PasteHTML function.
     
    PasteHTML()

    This method is used for pasting the specified HTML into a range within an editor document. If anything is selected, the selection is replaced with the new HTML and text.

    Example:

    // get the cute editor instance
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');

    // pasting the specified HTML into a range within a editor document
    editor1.PasteHTML("Hello World");

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML