paste does cleanUp() on entire document

John G
08-05-22 15:57

Tim,

Can't see how to make your suggestion work, because the onpaste event occurs after the paste: by the time we detect the paste the content is already in the document. Since we have no access to the paste buffer itself, we still do not know exactly what was pasted.

paste does cleanUp() on entire document
tim mackey
08-05-22 10:00
hi john. just reposting this message since i saw the old threads were lost with the server change. 

would it work if we intercept the paste event and create a new Whizzy editor in memory, do the paste in the in-memory editor, do the clean up, and pull out the cleaned text when it's finished?  if this could all be done synchronously it would be great.  since the editor is based on a textarea, perhaps the code could create a textarea in the document on-the-fly and use that as the paste/clean whizzy editor.  or if that was too complicated, we could use the existing textarea and just swap out the full document HTML to give us an empty editor to use for the paste operation.  then put the full document HTML back in after the cleanup function, and insert the new content?

thanks
tim


John Goodman
07-09-27 12:18

The problem is that you cannot get at the paste buffer with Javascript, so you cannot isolate the pasted text and cleanup that alone.

The best solution I can think od is to pop-up a ne window, paste into that, clean it andthen insert into the document. Which seems very clunky, so I haven't done it.

Any suggestions?

 

paste does cleanUp() on entire document
tim mackey
07-09-06 17:55
hi.  the cleanUp() function is obviously a great feature to remove all the MS crud.
but a user recently reported a problem where pasting a chunk of rich text from word caused the entire document to get reformatted.  i noticed in the code that it listens for Ctrl+V and does a setTimeOut on cleanUp(), which applies to the entire document.
i notice that the function takes the entire HTML as follows: var h=oW.document.body.innerHTML;
could this be configured for paste so that it only captures the pasted HTML and cleans that up?
thanks
tim

New Message


Your message

Type in these letters/numbers Type in this code (prevents automated submissions).
Can't make it out? Double click it for new code.


hide menu | Show caps
Google