This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
After having copied HTML source from a Mozilla 1.6 "view source" window, the HTML editor changes the text that is pasted. It adds html, body, pre, and span tags, and changes all the angle-brackets into HTML escape sequences. I can see how this might be useful, but it also has to be possible to get around it. Pasting with Ctrl+V(paste) or Ctrl+Shift+V(paste-formatted) give the same result. Perhaps only do the munging if the document is empty, or having one of the paste methods paste it as is (strip the formatting) is a better solution.
I'm not able reproduce this. If you have still this problem now, please reopen the bug.
Created attachment 17821 [details] screen shot of html paste behaviour I'm comlaining about
Created attachment 17822 [details] screen shot of html paste behaviour I'm comlaining about
I'm still seeing this behaviour.. see attached screenshot (Sorry about the double submit on the attachment; Issuezilla is slow today, my connection timed out.)
I'm on Mozilla 1.7 now, and I see the same behaviour. I don't see this behavour with copied text out of input boxes on a web page, just where the text has some layout: from web pages apart from input boxes; and from the source viewer, as shown in my attachment.
Thanks for the screenshot. Now I understand correctly.
*** Issue 49698 has been marked as a duplicate of this issue. ***
I think this is Windows specific issue. I'm not able to reproduce it on linux, but on the windows yes.
The application can put a text to the clipboard with different content types. When you copy something from Mozilla then windows clipboard includes these as well: text/html(text/html; class=java.nio.CharBuffer; charset=Unicode) : <html><body> <!--StartFragment --> <pre id="line28"><<span class="start-tag">INPUT</span><span class="attribute-name"> TYPE</span>=<span class="attribute-value">HIDDEN </span><span class="attribute-name">NAME</span>=<span class="attribute-value">"delta_ts" </span><span class="attribute-name">VALUE</span>=<span class="attribute-value">"20040830202042"</span>></pre> <!--EndFragment--> </body> </html> text/plain(text/plain; class=java.nio.CharBuffer; charset=Unicode) : <INPUT TYPE=HIDDEN NAME="delta_ts" VALUE="20040830202042"> Because the html document in the netbeans has text/html content type, the JTextComponent chooses from the clipboard the text/html part.
Are you suggesting this is a Mozilla bug? Perhaps they should not be further marking-up text taken from the "View Source".
I am editing HTML _source_ in this case; shouldn't the type be text/plain? If I was pasting into a WYSIWYG HTML editor, then I could understand it taking text/html from the clipboard.
I don't think, this is Mozilla bug. I think this is netbeans bug. But I don't have an idea how to fix. Maybe hack the paste action. I am going to look at this.
I'm not sure, whether I will be able to fix this into NB 4.0 release.
Can you please Peter explain why you think this is only P4 ? I personally face it at least once a week and to tell the truth I really hate to: 1. CTRL+C in Mozilla 2. CTRL+V in Notepad 3. CTRL+A in Notepad 4. CTRL+C in Notepad and finally ... 5. CTRL+V in NetBeans editor ... :-(
I encountered this bug earlier and used the notepad workaround but this is not usable if you use the IDE as your primary html editor (which I am trying to do). I am raising to P2 based on: http://qa.netbeans.org/processes/bug_priority_guidelines.html because I think this is a serious usability problem and the workaround is impractical to use -- copy/paste is used too often. (BTW, this is the 3rd open issue with most votes in IZ) What do notepad or other editors do that they do not add the wrapping text? I think if you remove the wrapper text when pasting into html source editor then that is not 'hacking', that is how it is supposed to be.
Pavel I agree with you. It's irritating issue in Windows. Whole problem is, that mozilla and some other application includes into clipboard more "versions" of the selected text. Every version is marked by flavour. The application which want to paste a text from clipboard, choose the text with the appropriate flavour. The flavour in this case is very similar to the content type. So when you copy a selected text from mozilla, then mozilla includes to the clipboard text with flower "text/plain", "text/html" and other with "binary" .... Unfortunately the swing components choose the text with the flavour which is the same as content type. The html editor has content type text/html => the text with "text/html" flavour is chosen. Why fix it? 1) Change the content type of the html editor to text/plain 2) Rewrite the paste action The first solution has a lot of consequences for other editors such as jsp editor. So this solution we have to refuse. The second solution looks like good idea. The problem is, that Netbeans already rewrites the paste action in the core. I need more time to find out how to fix this in the core, or how to rewrite the paste action, which is in the core.
I'm sorry, there shouldn't be Why fix it? but How fix it in my previous comment:)
Created attachment 20048 [details] convetor the deletes the text/html flavor
The experiment shows that a writing a convertor that simply removes the text/html flavor helps. (It also needs to be registered in lookup, add META-INF.services/org.openide.util.datatransfer.ExClipboard$Convertor with org.netbeans.modules.html.HtmlClipboardConvertor in it). The problem is ExClipboard.Convertor says you should not generally remove flavors. I did not have time to try to try doing something with PasteType instead of removing DataFlavors but it should be possible, javadoc for ExClipboard shows something similar (though with nodes).
fixed in [maintrunk] /cvs/html/editor/src/org/netbeans/modules/editor/html/HTMLKit.java,v <-- HTMLKit.java new revision: 1.4; previous revision: 1.3
+ adding forgotten //NOI18N comments: /cvs/html/editor/src/org/netbeans/modules/editor/html/HTMLKit.java,v <-- HTMLKit.java new revision: 1.6; previous revision: 1.5 and [REWRITE_PLACE] fix info: /cvs/html/editor/src/org/netbeans/modules/editor/html/HTMLKit.java,v <-- HTMLKit.java new revision: 1.5; previous revision: 1.4 Complete diff from 1.3 - 1.6
Verified in trunk, Martine could you please merge it to release41_beta? Thanks.
fixed in [release41_beta] /cvs/html/editor/src/org/netbeans/modules/editor/html/HTMLKit.java,v <-- HTMLKit.java new revision: 1.3.6.1; previous revision: 1.3
Verified.
Just downloaded v4.1, and it's fixed! Thanks everyone who worked on it, Zac