Bug #31579
closedCopied MS Word content becomes broken after saving and opening text content element
0%
Description
Copy content from MS Word file that has a table (example file is attached), execute "Remove MS Word format" click "Toggle text mode" once. You can see HTML
<table border="1" cellpadding="0" cellspacing="0"> <tbody><tr> <td valign="top" width="295"> <p>...
After clicking "Toggle text mode" and returning to wysiwyg mode table border looks wide, text in table cells has extra spaces before and after it. When clicking "Toggle text mode" again, HTML code look such way -
<table border="1" cellpadding="0" cellspacing="0"> <tbody><tr> <td valign="top" width="295"> <p>... HTML is fine.
You can get such broken HTML also copying content from MS Word and saving changes. Next time record is opened for editing (also after clicking "Save document" which renders record immediately after saving) the table in wysiwyg mode looks broken.
When htmlarea converts copied content from MS Word to HTML it creates whitespaces between HTML tags. At rendering in wysiwyg mode (clicking "Toggle text mode" twice or saving and opening the record) spaces between tags are converted to .
I have solved this problem by removing some lines from typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js file (patch is attached). Htmlarea in typo3 version 4.2.5 did not have those lines of code and did not produce broken HTML in the was described here.
Files