<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Forcing Paste-as-Plain-Text in&#160;TinyMCE</title>
	<atom:link href="http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 21:45:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Mark</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-769</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 29 Jul 2009 15:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-769</guid>
		<description>I offered this code when I found that people were simply not using the editor clean-up functionality which comes bundled with TinyMCE.

Glad some people found a use for it, it was essentially a butchered version of earlier MS-Word clean up scripts, but seemed to work for me.</description>
		<content:encoded><![CDATA[<p>I offered this code when I found that people were simply not using the editor clean-up functionality which comes bundled with TinyMCE.</p>
<p>Glad some people found a use for it, it was essentially a butchered version of earlier MS-Word clean up scripts, but seemed to work for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rebecca Younes</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-768</link>
		<dc:creator>Rebecca Younes</dc:creator>
		<pubDate>Thu, 11 Jun 2009 14:59:58 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-768</guid>
		<description>Your code works for me, but doesn&#039;t seem to offer any functionality over the config option

paste_auto_cleanup_on_paste : true

However, I&#039;ve found that both solutions render the keyboard Delete button in the editor window useless. That is, when I select text and hit Delete, nothing happens. Have you encountered this problem, and is there a solution?</description>
		<content:encoded><![CDATA[<p>Your code works for me, but doesn&#8217;t seem to offer any functionality over the config option</p>
<p>paste_auto_cleanup_on_paste : true</p>
<p>However, I&#8217;ve found that both solutions render the keyboard Delete button in the editor window useless. That is, when I select text and hit Delete, nothing happens. Have you encountered this problem, and is there a solution?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Job</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-767</link>
		<dc:creator>Job</dc:creator>
		<pubDate>Wed, 03 Jun 2009 16:37:14 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-767</guid>
		<description>thanks, just what i wanted.
The popup is a bit slow, but thats something i guess i have to live with..</description>
		<content:encoded><![CDATA[<p>thanks, just what i wanted.<br />
The popup is a bit slow, but thats something i guess i have to live with..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory LaViska</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-766</link>
		<dc:creator>Cory LaViska</dc:creator>
		<pubDate>Sat, 02 May 2009 02:52:56 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-766</guid>
		<description>It&#039;s worth mentioning that TinyMCE 3.2.3 was released on April 23, 2009.  This new version includes a completely rewritten version of the Paste From Word plugin, which no longer requires users to click the toolbar and paste their Word content into a dialog.

I&#039;ve done some pretty thorough testing and it looks like the new version of this plugin is doing its job extremely well.  Although it&#039;s not a replacement for Paste-as-plain-text functionality, if you were considering forcing your users to paste as plain text because of problems with MS Word code, you might simply try upgrading TinyMCE to the latest version instead.

More info: http://tinymce.moxiecode.com/changelog.php</description>
		<content:encoded><![CDATA[<p>It&#8217;s worth mentioning that TinyMCE 3.2.3 was released on April 23, 2009.  This new version includes a completely rewritten version of the Paste From Word plugin, which no longer requires users to click the toolbar and paste their Word content into a dialog.</p>
<p>I&#8217;ve done some pretty thorough testing and it looks like the new version of this plugin is doing its job extremely well.  Although it&#8217;s not a replacement for Paste-as-plain-text functionality, if you were considering forcing your users to paste as plain text because of problems with MS Word code, you might simply try upgrading TinyMCE to the latest version instead.</p>
<p>More info: <a href="http://tinymce.moxiecode.com/changelog.php" rel="nofollow">http://tinymce.moxiecode.com/changelog.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Lawrence</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-765</link>
		<dc:creator>Simon Lawrence</dc:creator>
		<pubDate>Fri, 01 May 2009 15:26:25 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-765</guid>
		<description>Thanks Cory, this is just what I was looking for!

I agree that the best approach is to prevent users from entering rubbish HTML in the first place rather than trying to clean it up afterwards and can be confusing when all your formatting disappears.

But I do use a server side clean up function as a last resort. I have posted the PHP code for those interested as I couldn&#039;t find anything like this out there so if might save someone some time. It is based on the code at http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php

function clean_word_html($input) {
	$input = preg_replace(&#039;/&lt;o:p&gt;\s*&lt;\/o:p&gt;/&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;o:p&gt;.*?&lt;\/o:p&gt;/&#039;, &#039;&#160;&#039;, $input);
	$input = preg_replace(&#039;/\s*mso-[^:]+:[^;&quot;]+;?/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*MARGIN: 0cm 0cm 0pt\s*;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*MARGIN: 0cm 0cm 0pt\s*&quot;/i&#039;, &#039;\&quot;&#039;, $input);
	$input = preg_replace(&#039;/\s*TEXT-INDENT: 0cm\s*;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*TEXT-INDENT: 0cm\s*&quot;/i&#039;, &#039;\&quot;&#039;, $input);
	$input = preg_replace(&#039;/\s*TEXT-ALIGN: [^\s;]+;?&quot;/i&#039;, &#039;\&quot;&#039;, $input);
	$input = preg_replace(&#039;/\s*PAGE-BREAK-BEFORE: [^\s;]+;?&quot;/i&#039;, &#039;\&quot;&#039;, $input);
	$input = preg_replace(&#039;/\s*FONT-VARIANT: [^\s;]+;?&quot;/i&#039;, &#039;\&quot;&#039;, $input);
	$input = preg_replace(&#039;/\s*tab-stops:[^;&quot;]*;?/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*tab-stops:[^&quot;]*/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*face=&quot;[^&quot;]*&quot;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*face=[^ &gt;]*/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*FONT-FAMILY:[^;&quot;]*;?/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*FONT-SIZE: x-small\s*;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*color:[^;&quot;]*;?/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/\s*background:[^;&quot;]*;?/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;(\w[^&gt;]*) class=([^ &#124;&gt;]*)([^&gt;]*)/i&#039;, &#039;&lt;$1$3&#039;, $input);
	$input = preg_replace(&#039;/\s*style=&quot;\s*&quot;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;SPAN\s*[^&gt;]*&gt;\s*&#160;\s*&lt;\/SPAN&gt;/i&#039;, &#039;&#160;&#039;, $input);
	$input = preg_replace(&#039;/&lt;SPAN\s*[^&gt;]*&gt;&lt;\/SPAN&gt;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;(\w[^&gt;]*) lang=([^ &#124;&gt;]*)([^&gt;]*)/i&#039;, &#039;&lt;$1$3&#039;, $input);
	$input = preg_replace(&#039;/&lt;SPAN\s*&gt;(.*?)&lt;\/SPAN&gt;/i&#039;, &#039;$1&#039;, $input);
	$input = preg_replace(&#039;/&lt;FONT\s*&gt;(.*?)&lt;\/FONT&gt;/i&#039;, &#039;$1&#039;, $input);
	$input = preg_replace(&#039;/&lt;\\?\?xml[^&gt;]*&gt;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;\/?\w+:[^&gt;]*&gt;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;(B&#124;b)&gt;&#160;&lt;\/\b&#124;B&gt;/&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&lt;P\s*[^&gt;]*&gt;\s*&#160;\s*&lt;\/P&gt;/i&#039;, &#039;&#039;, $input);
	$input = preg_replace(&#039;/&gt;\s*&#160;\s*&lt;\//i&#039;, &#039;&gt;&lt;/&#039;, $input);
	$input = preg_replace(&#039;/&lt;([^\s&gt;]+)[^&gt;]*&gt;\s*&lt;\/\1&gt;/&#039;, &#039;&#039;, $input);
	return $input;
}</description>
		<content:encoded><![CDATA[<p>Thanks Cory, this is just what I was looking for!</p>
<p>I agree that the best approach is to prevent users from entering rubbish HTML in the first place rather than trying to clean it up afterwards and can be confusing when all your formatting disappears.</p>
<p>But I do use a server side clean up function as a last resort. I have posted the PHP code for those interested as I couldn&#8217;t find anything like this out there so if might save someone some time. It is based on the code at <a href="http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php" rel="nofollow">http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php</a></p>
<p>function clean_word_html($input) {<br />
	$input = preg_replace(&#8216;/<o:p>\s*< \/o:p>/&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/</o:p><o:p>.*?< \/o:p>/&#8217;, &#8216;&nbsp;&#8217;, $input);<br />
	$input = preg_replace(&#8216;/\s*mso-[^:]+:[^;"]+;?/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*MARGIN: 0cm 0cm 0pt\s*;/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*MARGIN: 0cm 0cm 0pt\s*&#8221;/i&#8217;, &#8216;\&#8221;&#8216;, $input);<br />
	$input = preg_replace(&#8216;/\s*TEXT-INDENT: 0cm\s*;/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*TEXT-INDENT: 0cm\s*&#8221;/i&#8217;, &#8216;\&#8221;&#8216;, $input);<br />
	$input = preg_replace(&#8216;/\s*TEXT-ALIGN: [^\s;]+;?&#8221;/i&#8217;, &#8216;\&#8221;&#8216;, $input);<br />
	$input = preg_replace(&#8216;/\s*PAGE-BREAK-BEFORE: [^\s;]+;?&#8221;/i&#8217;, &#8216;\&#8221;&#8216;, $input);<br />
	$input = preg_replace(&#8216;/\s*FONT-VARIANT: [^\s;]+;?&#8221;/i&#8217;, &#8216;\&#8221;&#8216;, $input);<br />
	$input = preg_replace(&#8216;/\s*tab-stops:[^;"]*;?/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*tab-stops:[^"]*/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*face=&#8221;[^"]*&#8221;/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*face=[^ >]*/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*FONT-FAMILY:[^;"]*;?/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*FONT-SIZE: x-small\s*;/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*color:[^;"]*;?/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/\s*background:[^;"]*;?/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/< (\w[^>]*) class=([^ |>]*)([^>]*)/i&#8217;, &#8216;< $1$3', $input);<br />
	$input = preg_replace('/\s*style="\s*"/i', '', $input);<br />
	$input = preg_replace('/<SPAN\s*[^>]*>\s*&nbsp;\s*< \/SPAN>/i&#8217;, &#8216;&nbsp;&#8217;, $input);<br />
	$input = preg_replace(&#8216;/<span \s*[^>]*>< \/SPAN>/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/< (\w[^>]*) lang=([^ |>]*)([^>]*)/i&#8217;, &#8216;< $1$3', $input);<br />
	$input = preg_replace('/<SPAN\s*>(.*?)< \/SPAN>/i&#8217;, &#8216;$1&#8242;, $input);<br />
	$input = preg_replace(&#8216;/<font \s*>(.*?)< \/FONT>/i&#8217;, &#8216;$1&#8242;, $input);<br />
	$input = preg_replace(&#8216;/< \\?\?xml[^>]*>/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/< \/?\w+:[^>]*>/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/< (B|b)>&nbsp;< \/\b|B>/&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/
<p \s*[^>]*>\s*&nbsp;\s*< \/P>/i&#8217;, &#8221;, $input);<br />
	$input = preg_replace(&#8216;/>\s*&nbsp;\s*< \//i', '>]+)[^>]*>\s*< \/\1>/&#8217;, &#8221;, $input);<br />
	return $input;<br />
}</p>
<p></font></span></o:p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory LaViska</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-764</link>
		<dc:creator>Cory LaViska</dc:creator>
		<pubDate>Fri, 03 Apr 2009 13:05:59 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-764</guid>
		<description>@Thomas, good call.  I neglected to mention that this ONLY works with the paste plugin enabled.  You can also use the inlinepopups plugin if you don&#039;t want the dialog to be in a separate window.</description>
		<content:encoded><![CDATA[<p>@Thomas, good call.  I neglected to mention that this ONLY works with the paste plugin enabled.  You can also use the inlinepopups plugin if you don&#8217;t want the dialog to be in a separate window.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas LundstrÃ¶m</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-763</link>
		<dc:creator>Thomas LundstrÃ¶m</dc:creator>
		<pubDate>Fri, 03 Apr 2009 12:30:49 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-763</guid>
		<description>Andy Matthews, I don&#039;t know if you have found a solution or not, but it worked for me after I added the paste plugin in my init, i.e. including e.g.

plugins: &quot;safari,paste&quot;,

in your init function.</description>
		<content:encoded><![CDATA[<p>Andy Matthews, I don&#8217;t know if you have found a solution or not, but it worked for me after I added the paste plugin in my init, i.e. including e.g.</p>
<p>plugins: &#8220;safari,paste&#8221;,</p>
<p>in your init function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andy matthews</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-762</link>
		<dc:creator>andy matthews</dc:creator>
		<pubDate>Fri, 16 Jan 2009 21:04:28 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-762</guid>
		<description>Just FYI, I&#039;ve ruled out the errors as part of this problem. Apparently they were there before I started working on the &quot;clean up word&quot; issue.</description>
		<content:encoded><![CDATA[<p>Just FYI, I&#8217;ve ruled out the errors as part of this problem. Apparently they were there before I started working on the &#8220;clean up word&#8221; issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Matthews</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-761</link>
		<dc:creator>Andy Matthews</dc:creator>
		<pubDate>Fri, 16 Jan 2009 20:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-761</guid>
		<description>This isn&#039;t working in my case. I&#039;ve tried it in both Chrome and FF3 and when ( CTRL + V nothing happens. FF shows 2 errors when tinyMCE loads, but for some reason doesn&#039;t show me line numbers or reasons.

Here&#039;s my TinyMCE init code:

// initialize the tinyMCE textarea
tinyMCE.init({
	mode : &quot;textareas&quot;,
	theme : &quot;simple&quot;,
	width : &quot;500&quot;,
	height : &quot;230&quot;,
    setup: function(ed) {

        // Force Paste-as-Plain-Text
        ed.onPaste.add( function(ed, e, o) {
            ed.execCommand(&#039;mcePasteText&#039;, true);
            return tinymce.dom.Event.cancel(e);
        });

    }
});

Anyone see any problems?</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t working in my case. I&#8217;ve tried it in both Chrome and FF3 and when ( CTRL + V nothing happens. FF shows 2 errors when tinyMCE loads, but for some reason doesn&#8217;t show me line numbers or reasons.</p>
<p>Here&#8217;s my TinyMCE init code:</p>
<p>// initialize the tinyMCE textarea<br />
tinyMCE.init({<br />
	mode : &#8220;textareas&#8221;,<br />
	theme : &#8220;simple&#8221;,<br />
	width : &#8220;500&#8243;,<br />
	height : &#8220;230&#8243;,<br />
    setup: function(ed) {</p>
<p>        // Force Paste-as-Plain-Text<br />
        ed.onPaste.add( function(ed, e, o) {<br />
            ed.execCommand(&#8216;mcePasteText&#8217;, true);<br />
            return tinymce.dom.Event.cancel(e);<br />
        });</p>
<p>    }<br />
});</p>
<p>Anyone see any problems?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elijah Grey</title>
		<link>http://www.abeautifulsite.net/blog/2008/10/forcing-paste-as-plain-text-in-tinymce/#comment-760</link>
		<dc:creator>Elijah Grey</dc:creator>
		<pubDate>Sun, 04 Jan 2009 21:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://abs.lavitech.com/?p=82#comment-760</guid>
		<description>For the onPaste trouble, I rely on checking if Ctrl is pressed and hasn&#039;t been unpressed (via keycodes) and listen for V&#039;s keycode onkeypress.</description>
		<content:encoded><![CDATA[<p>For the onPaste trouble, I rely on checking if Ctrl is pressed and hasn&#8217;t been unpressed (via keycodes) and listen for V&#8217;s keycode onkeypress.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

