File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Copy n' Paste in JEditorPane wraps text in new css..?

 
Tim Quinn
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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!

 
Tim Quinn
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic