I'm attaching version 2 of the patch. The problem with the heart emoticon is fixed.
The value of the ALT attribute is escaped before replacing the image element with it. To escape that strings I'm using escapeHTMLChars method. This method was defined in ChatHtmlUtils class, but in order to avoid including impl bundle (gui impl bundle, where ChatHtmlUtils is defined) in desktoputils bundle (where the ExtendedTransferHandler class is defined), I moved that method in GuiUtils class.
On Thu, Feb 21, 2013 at 12:35 PM, Yana Stamcheva <firstname.lastname@example.org> wrote:
Really nice patch!! It's now committed (r10469) and ack-ed!
When testing the feature, I was confronted to two small problems and I thought that they're worth mentioning, so that we try to fix them while we're there The first thing is that if I send heart, which text is "<3" only the number 3 is copied and the "<" disappears. The thing that's maybe more tricky to solve is that the user doesn't really see that the images are actually copied, i.e. there's no blue selection over the image. While this is really a small detail I think we could have a quick look, because it could really enhance the user experience
On Feb 20, 2013, at 1:29 PM, Hristo Terezov <email@example.com> wrote:
> If you try to copy a selected text that contains image (for example smiley or link of an image) from the chat window, the text for the image is not copied. This patch changes the implementation to replace all image tags with the value of the ALT attribute in the selected text if the text contains any images.
> The patch can be tested if you send some messages wtih smileys and then select text from the messages that contains smiley. If you try to copy the text and paste it the smiley image in the text should be replaced with the text which was originaly written for the smiley. For example if the original message is "test test" and you select the whole message and copy / paste it, the pasted text will be "test test" instead of "test test" (which is the behavior without the patch).
> The same functionality works if you drag the selected text instead of copy it.