Users who have pasted from Microsoft Word or HTML directly into TinyMCE Advanced visual editor window, without first clicking either of the “Paste from Word” or “Paste as Plain Text” buttons, have discovered a lot of confusing, Word-specific styling info carried over into your content. See example below. Skipping either of these “paste” buttons is easy to do, even for longtime GRC WordPress users.
What we ideally want to achieve is for users to get at least one of the above two button behaviors if the user pastes directly into the visual editor.
Note: This solution was for WordPress 2.7x and an earlier version of TinyMCE Advanced. Please see comments below for any updates regarding WordPress 2.8x and above.
Resolution: By changing both instances of the value “paste_auto_cleanup_on_paste” from “false” to “true” in the following WordPress file,
/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
we achieved the following button behavior, when pasting from Word directly into the visual editor, using the following browsers (on Windows, but we suspect these browsers will behave the same way in Linux or Apple):
- Internet Explorer 7: “Paste fromWord.” To “Paste as Plain Text,” you must first select that button.
- Firefox, Safari, Opera: “Pastes as Plain Text” dialog box opens; you must then paste again. To “Paste from Word,” you must first select that buton.
Sample of Styling Information Pasted from Microsoft Word
<p><!–[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val=”Cambria Math” /> <m:brkBin m:val=”before” /> <m:brkBinSub m:val=”--” /> <m:smallFrac m:val=”off” /> <m:dispDef /> <m:lMargin m:val=”0″ /> <m:rMargin m:val=”0″ /> <m:defJc m:val=”centerGroup” /> <m:wrapIndent m:val=”1440″ /> <m:intLim m:val=”subSup” /> <m:naryLim m:val=”undOvr” /> </m:mathPr></w:WordDocument> </xml><![endif]–><!–[if gte mso 9]><xml> <w:LatentStyles DefLockedState=”false” DefUnhideWhenUsed=”true” DefSemiHidden=”true” DefQFormat=”false” DefPriority=”99″ LatentStyleCount=”267″> <w:LsdException Locked=”false” Priority=”0″ SemiHidden=”false” UnhideWhenUsed=”false” QFormat=”true” Name=”Normal” /> <w:LsdException Locked=”false” Priority=”9″ SemiHidden=”false” UnhideWhenUsed=”false” QFormat=”true” Name=”heading 1″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 2″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 3″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 4″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 5″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 6″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 7″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 8″ /> <w:LsdException Locked=”false” Priority=”9″ QFormat=”true” Name=”heading 9″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 1″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 2″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 3″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 4″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 5″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 6″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 7″ /> <w:LsdException Locked=”false” Priority=”39″ Name=”toc 8″ />
<!–[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:”";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:”Times New Roman”;
mso-bidi-theme-font:minor-bidi;}
</style>
<![endif]–>


One Comment
Posted September 10, 2009 at 12:48 pm | Permalink
Note: This issue continues to a lesser degree with the recent upgrade to WordPress 2.8.4 and the accompanying, required, upgrade to the TinyMCE Advanced 3.2.4 plugin.
According to the Moxiecode site, the TinyMCE “paste” plugin was completely rewritten for TinyMCE 3.2.3. “The new version will auto detect Word contents and automatically clean it up before inserting it to the editor. So there is no longer any need to use the dialogs to paste contents from third party sources. (More info: Paste Plugin for TinyMCE).
Overall, we still recommend that best results can be found by selecting the “Paste from Text” button before pasting text from any Microsoft Office product.