I am writing a wysiwyg editor for html documents. I am using a JEditorPane with HTMLEditorKit.
When a user copies and pastes text, or if they highlight text and drag it, the text that they moved gets wrapped in all the css divs that were wrapping the entire document. So if I have a css border wrapping everything, copy and paste will produce three borders: a border around the top text, a border around the moved text, and a border around the bottom text.
The short self-contained example below illustrates what I mean. Try copying and pasting, or highlighting and dragging. The result is awful.
Anyone know how to gt it to copy just the text, and not all the div wrappings?
Thanks very much for any help!
Joined: Sep 11, 2007
(bump) Anyone have any thoughts on this?
I assume that the copy-and-paste is trying to do some clever popping out to find the furthest out html, but I wish it wouldn't try top be so clever.
I thought possibly I could overwrite to JEditorPane's actionMap, but I wasn't sure how to reliably catch the copy or paste action, especially as the same effect appears if you highlight and drag.
Any thoughts still greatly appreciated!
Tim [ February 20, 2008: Message edited by: Tim Quinn ]