Closed Bug 850663 Opened 7 years ago Closed 6 years ago
Paste from Word doesn't result in HTML in clipboard
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.33 (KHTML, like Gecko) Chrome/27.0.1430.3 Safari/537.33 Steps to reproduce: 1. Opened the paste_rich.html 2. Opened the test.rtf in Office 2007 on Windows 7. 3. Selected and copied the rich formatted "TEST" from Office. 4. Pasted the rich text into the contentEditable area in paste_rich.html. 5. Observer that it wasn't properly converted to HTML. Actual results: RTF/Word contents isn't properly converted to HTML in clipboardData though converted when inserted into contentEditable. Expected results: RTF/Word contents should be converted into an HTML variant as WebKit/Opera does it.
It's really important for rich text editors like TinyMCE/CKEditor etc to be able to get Word contents as HTML so it can be filtered before inserting it to the editor. This can be done in WebKit and Opera using their Clipboard API implementations but currently not in the Firefox 22 nightly.
What do you see in the Web Console? I don't have access to a machine with MS Office installed on it at the moment in order to test this.
I'm guessing that this is because DOMDataTransfer needs to be able to handle kNativeHTMLMime (application/x-moz-nativehtml). This maps to the windows CF_HTML type which is html with some additional header info. See http://msdn.microsoft.com/en-us/library/aa767917%28v=vs.85%29.aspx.
To be clear, pasting still works fine from Word. (I tested this with Word 2010). The data just isn't reflected in the clipboardData object.
This patch shows that the nativehtml type can be supported easily. However, it might be more useful (and compatible) to parse the text using nsHTMLEditor::ParseCFHTML or something like it and return it as text/html instead of text/x-moz-nativehtml. This works with the CF_HTML data copied from IE.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 586587
Using Firefox 31.0, bug still exists. Copying formatted text from Word results in clipboardData with 1 type: text/plain, without formatting.
You need to log in before you can comment on or make changes to this bug.