WordPress Plain Text Paste Plugin

This plugin is currently incompatible with WP 2.1. I hope to update it shortly. Check back here for updates.
Version 0.3 is compatible with WordPress 2.1

This plugin adds buttons to the WordPress rich text editor (TinyMCE) for pasting in clipboard content as plain text.

plain text paste screenshotThis solves the problem of users needing to paste Microsoft Word documents, web pages, or any other rich text content into a plain text editor such as notepad to strip out the HTML nasties that have a tendency to ruin a blog’s layout. By using TinyMCE’s paste plugin, the plugin is smart enough to maintain some basic formatting.

Go ahead and take it for a spin. Extract nds-paste folder from the archive and copy it to wp-content/plugins.
nds-paste-0.2.zip
nds-paste-0.2.tar.gz

Developers note: You should be able to use this code to port other TinyMCE plugins into Wordpress as well. I had to use an older version of TinyMCE’s paste that did not call the addPlugin() function. Once I found a working version, the only thing required was adjusting the paths to hit the new directory.

I’d love to find a way to have this plugin hook into a CTRL+V keypress and open automatically. I believe FCKeditor provides this functionality. If anyone has any suggestions, let me know.

Comments

  • September 2, 2006 at 3:40 a.m. #
    Thomas added:

    Or have a look to the WIN32 Desktoptoll PureText => http://www.stevemiller.net/puretext/

    Regards Thomas

  • September 9, 2006 at 12:26 p.m. #
    Jamie McDaniel added:

    Your plugin that allows WordPress to use the TinyMCE paste plugin worked great. Thanks!

  • September 10, 2006 at 2:56 a.m. #
    JamesICT responded:

    I have added the plugin to the plugin directory and activated but it is not shwoing in the Rich Text Editor.

    Using WP 2.04

    Any ideas as to why it may not work in some situations?

    This looks like a great plugin and very useful. Your help is much appreciated :)

  • September 10, 2006 at 9:19 a.m. #
    Peter Baumgartner commented:

    JamesICT: What OS and browser combination are you using? I only tested it on a handful of browsers. Feel free to email me for support. We’ll be sure to post the fix here once we figure it out.

  • September 10, 2006 at 10:32 a.m. #
    JamesICT mentioned:

    Hi Peter,

    Windows XP Pro and Firefox 1.5.0.6

    There is nothing too different in my setup really.

    Thanks for helping :)

  • September 10, 2006 at 7:51 p.m. #
    Mr Papa mentioned:

    Nice job… My wife loves to edit in Word and it ALWAYS messed up the theme… This solves her problem and removes a clean up task I always got saddled with.

    Mr Papa

  • September 16, 2006 at 10:36 a.m. #
    Jamie piped up:

    The EditorMonkey plugin actually has a plugin for TinyMCE with it that has the paste as text function as well as a strip word formatting plugin. EditorMonkey is no longer being supported, but you may want to look at their code and incorporate the Strip Word Formatting option into this, since they are very similar.

    http://www.rajprasad.net/plugins/editormonkey/

  • September 16, 2006 at 12:45 p.m. #
    TechZ added:

    Excellent idea for a plugin, gonna add it asap. Thanks!

  • September 16, 2006 at 3:39 p.m. #
    Peter Baumgartner piped up:

    @Jaimie

    The Word formatting button is already included :)

  • September 17, 2006 at 12:45 a.m. #
    Mani added:

    Well, Have u ever tried to press ALT+B in TinyMCE Editor in Wordpress? It DOES have this functionalities inside!

    Paste From Word + Plain Text + Mess Clean Up

  • September 17, 2006 at 6:35 a.m. #
    Peter Baumgartner piped up:

    @Mani
    I know the shortcut key functionality is there, I’m just looking for a way to hook into it without entirely replacing the existing rich text editor. IIRC, the code you’re referring to is part of the core functionality of TinyMCE and gets loaded well before the hook I used for this plugin.

    BTW, after a few emails back and forth, we finally figured out JamesICT’s problem was that the plugin was loaded into the wrong directory. So no install issues to speak of so far. :)

  • September 17, 2006 at 1:38 p.m. #
    Mani chimed in with:

    Sorry , I correct.

    ALT+B just works in WP 2.1 (Alpha) and Wordpress.com.

  • September 17, 2006 at 2:06 p.m. #
    Peter Baumgartner chimed in with:

    Oh, I see. In 2.0 ALT+b toggles bold text. I guess this plugin will be superceded by 2.1.

    The feature you’re talking about looks pretty cool. http://engtech.wordpress.com/2006/09/03/wordpress-tips-alt-b/

  • September 18, 2006 at 6:28 a.m. #
    John S piped up:

    This doesn’t seem to work with Mac OSX / Firefox. Is this expected behaviour, or is there a fix?
    cheers!

  • September 18, 2006 at 12:45 p.m. #
    Sara added:

    John S., try clearing your cache. I don’t know what it is, but I just upgraded to the latest version of Firefox onto my Mac, and today have had to clear my cache several times when working on my blog. Once the cache was cleared, this plugin’s buttons were visible and usable to me.

    Firefox menu -> Preferences -> Privacy -> Cache -> Clear Cache Now

    Best of luck!

  • September 18, 2006 at 12:53 p.m. #
    Sara piped up:

    Question — do you have documentation for how to use these three buttons? Also, I do like to be able to use the little tooltext that normally comes up when you mouse over a button in the editor (like, you mouse over the “B”, and then a little yellow box pops up that says “Bold (Ctrl + B)”). When I mouse over the three buttons for your plugin, they come up with stuff like “($lang_paste_text_desc)”.

    Assuming this is not just a problem in my blog, can you fix those so the tooltext makes sense to the unitiated?

    Thanks — I appreciate the plugin!

  • September 18, 2006 at 12:59 p.m. #
    Sara chimed in with:

    Ew Eek Ack, I should have tested further before posting.

    I am on a Mac using OSX and Firefox 1.5.07, and wordpress 2.0.4 for my blog.

    I installed your plugin. I can see the buttons. As noted above, the little tooltext is wrong. But even worse, when I click on any of the three buttons, instead of anything pasting into the page I’m editing, a new browser window pops up that is trying to reach the URL http://www.nkfreedomhouse.org/wp-content/plugins/nds-paste/paste/pastetext.htm . That causes a “404 not found” error. So, the plugin is completely not working for me.

    Hope you can help!

  • September 18, 2006 at 1 p.m. #
    Peter Baumgartner piped up:

    @Sara
    I didn’t write the script, I just hooked it into WP. So I don’t have any documentation. A Google search might turn up more info.

    I see the correct tooltips on my system. Could you try in another browser to see if you are still having issues? I might not be able to look at that for a couple of days.

  • September 18, 2006 at 1:03 p.m. #
    Peter Baumgartner piped up:

    @Sara
    You’re missing a couple of files there. Try re-uploading the plugin.

  • September 18, 2006 at 1:40 p.m. #
    Sara added:

    d’oh! gosh, thanks for the help, and I’m sorry for the confusion.

    Great adaptation, I appreciate it.

  • September 20, 2006 at 3:10 a.m. #
    John S responded:

    @Sara
    Thanks for the Firefox tip. Clearing the cache did indeed work. Now, if only TinyMCE worked in Safari…

  • September 20, 2006 at 6:35 a.m. #
    Seoras mentioned:

    Hi,
    I’m having the same problem as JamesICT, that is the buttons don’t show in Wordpress rich text editor. I’m running WP2.04 on FF1.5.0.6 on Win XP-Pro, I also tested on IE6 and I get the same result. I’d really love this to work as I’m fed up with having to stip out all the crap form Word docs etc. when all I want is the text.
    Hope you can help.

  • September 20, 2006 at 8:24 a.m. #
    Peter Baumgartner added:

    @Seoras
    1. Clear your browser cache.
    2. Make sure that you have uploaded the plugin correctly.
    All the issues so for have been related to these two things.

    Make sure that this URL works in your browser, replacing YOURDOMAIN.TLD with your own domain name.

    http://YOURDOMAIN.TLD/wp-includes/js/tinymce/plugins/paste/../../../../../wp-content/plugins/nds-paste/paste/images/pasteword.gif

  • September 21, 2006 at 6:15 a.m. #
    Seoras chimed in with:

    Peter,
    thanks for the help, I manages to get it working although the problem was not the cache etc. (which I’d already looked at) but the clue was in the URL you supplied. I’d uploaded the nds-paste.php file and the paste folder seperately to the plugins folder instead of in the nds-paste folder. Thanks for the help.
    Seoras

  • September 27, 2006 at 9:03 p.m. #
    Darren Ethier responded:

    Would you mind sharing the solution for the problems JamesICT had and Seoras had with the buttons not showing up in the Rich Text Editor? I’m having the same problem. I’ve tried copying the “nds-paste” folder into wp-content/plugins/ and I’ve also tried copying the “paste” and nds-paste.php seperately into the plugins folder and neither is working for me.
    Thanks for any help :)

  • September 27, 2006 at 9:34 p.m. #
    Darren Ethier piped up:

    Okay, nevermind…I found the solution for my problem. Here’s my fix.

    The problem was that in line 30,31,33 referenced a “real-path” that was incorrect for my wordpress install. I have wordpress setup with the index.php in the root directory of my www domain and all other wordpress files in the wordpress directory. All I had to do was add /wordpress/ before the /wp-content on each line and that fixed it for me. Thanks for a great WP adaptation of this plugin – it helps me out greatly :)

  • September 27, 2006 at 9:34 p.m. #
    Peter Baumgartner piped up:

    @Darren

    Try clearing your browser cache. If that doesn’t work, let me know what the uRL of your plugins folder is. I can take a look.

  • October 16, 2006 at 11:17 a.m. #
    3stripe added:

    Nice plugin.

    I’m hoping that a tip from http://tinymce.moxiecode.com/punbb/viewtopic.php?id=2077 will allow me to make 'Post as plain text’ the only option for users :)

    if (e.ctrlKey && e.keyCode == 86 && e.type != “keyup”) { tinyMCE.execInstanceCommand(e.target.editorId, “mcePasteText”, true); tinyMCE.cancelEvent(e); return false;
    }

  • October 31, 2006 at 5:43 p.m. #
    Jim Waters piped up:

    I found your plugin via the wordpress help forums. I receive word files from other people to put on our church website. I have only processed one word table with it so far. It worked very well. I had used Steve Millar’s PureText to deal with word files before, but it could not deal with word tables this seems to. Thank you very much :-)

  • December 2, 2006 at 2:10 p.m. #
    V. responded:

    Thanks¡¡¡¡
    You save my life :D, I have a client that messed up all the theme because he love Word
    Now I´m happy and he is happy

  • December 6, 2006 at 7:31 a.m. #
    Rio chimed in with:

    I think it would be really helpful if you included a note in the readme about where to upload the “paste” folder. I don’t think less tech savvy users would ever figure out that they need to upload to

    ../wp-content/plugins/nds-paste/paste/images/pasteword.gif

    -Rio

  • December 6, 2006 at 7:52 a.m. #
    pete mentioned:

    @Rio
    The paste folder is within the nds-paste folder. The instructions say to upload the nds-paste folder into /wp-content/plugins. If you follow those directions, the paste folder will end up in the proper place, or am I missing something?

  • December 6, 2006 at 7:58 a.m. #
    Rio mentioned:

    Apparently, I don’t know where to upload the files to.

    I didn’t realize you have to upload the entire nds-paste folder..

    Thanks for the plugin.

  • December 15, 2006 at 4:30 p.m. #
    Adam responded:

    I noticed a problem if the paths to the files in your plugin differ. The following code should clear up the problem.

    $pluginFile = dirname(__FILE__) . “/paste/editor_plugin.js”;
    $languageFile = dirname(__FILE__) . “/paste/langs/” . $locale . “.js”;
    if (!file_exists($languageFile)) $languageFile = dirname(__FILE__) . “/paste/langs/en.js”;

  • December 18, 2006 at 5:16 p.m. #
    Si Jobling added:

    This is perfect for my HTML-challenged clients who love to just copy and paste from Word.

    Great work and thanks for sharing with the World! You’ve saved me from hours of tidying up crappy style and class attributes.

  • December 27, 2006 at 5:44 a.m. #
    a-giâu commented:

    For installing under WordPress MU (the multi-blog edition), the following might be helpful: http://mu.wordpress.org/forums/topic.php?id=2958

  • January 14, 2007 at 7:41 a.m. #
    Michael B piped up:

    I just tested this plugin with 2.1beta 2, and it breaks the VRE. Well, doesn’t “break”, but the editor doesn’t show up at all. Deactivation returned the editor. Just an FYI.

  • January 15, 2007 at 8:24 p.m. #
    pete piped up:

    Thanks for the update Michael. It seems this plugin isn’t needed as of 2.1. As Mani pointed out above, it is activated by pressing ALT+B.

  • January 30, 2007 at 3:25 a.m. #
    mark chimed in with:

    Doesn’t work for me in WP2.1 either; I get the same problem as Michael B above: the visual editor just doesn’t appear anymore when this plugin (version 0.3) is activated. Refreshing doesn’t help.

    In WP2.1 though, pressing ALT+SHIFT+V in Firefox (and ALT+V in IE7) while editing in the visual modus brings up TinyMCE’s advanced options toolbar – so I guess this plugin isn’t needed anymore for my setup. Now I only have to find a way to get that toolbar switched on by default.

  • January 30, 2007 at 7:54 a.m. #
    pete commented:

    @mark
    You’ll find version 0.3 here. It is 2.1 compatible. There is also a link to it at the top of this page.

    I’ve tested it in IE6, IE7, FF2.0, and Opera 9. Have you tried clearing out your cache? Do you have any other RTE plugins?

  • April 24, 2007 at 4:29 p.m. #
    chancho piped up:

    thanks so much!!!!!

  • May 10, 2007 at 11:52 a.m. #
    Puripong piped up:

    I have found similar problem when I tried to installed them in the first time. I’m using wordpress 2.0.4 with Firefox 2.0 and I couldn’t find its button when I make my new post. but now I found solution for it. No need to clear browser cache or edit nds-paste.php You just need to upload them properly. You must upload “nds-paste” directory to wordpress plugins directory. Your upload path must be like this

    http://www.domain.tld/wp-content/plugins/nds-paste/

    and inside folder must have file and folder structure like this one.

    nds-paste.php
    /paste/

  • June 12, 2007 at 9:56 p.m. #
    Goldsztajn chimed in with:

    very, very useful plug-in, much appreciated. my only problem with the install was the need to change the pathways in lines 30, 31, 33 of the nds-paste.php file—may i humbly suggest you include a highlight of that at the top of the page.

  • June 22, 2007 at 1:49 a.m. #
    Lio chimed in with:

    I much appreciate this plug-in, but I have the problem that when I paste something with Ctrl+V, it paste it two times. Does anybody have an idea ?

  • July 4, 2007 at 4:18 a.m. #
    Jeremy Clulow piped up:

    Having installed the plugin, my visual editor fails to work atall now. I’ve deactivated the plugin, removed the folder, cleared my cache and re-installed WordPress. Visual editor still broken. Any ideas?

    Jeremy

  • July 4, 2007 at 4:39 a.m. #
    Jeremy Clulow added:

    I have to apologise, the plugin causing the Editor to vanish was “My Page Order”, not your plugin.
    Regards, Jeremy

  • July 6, 2007 at 7:09 a.m. #
    dyke responded:

    v0.3 seems to be not backwards compatible. using v0.2 on wp2.0 did work.

    thanks for the plugin

  • August 15, 2007 at 4:51 p.m. #
    Sophia commented:

    Hi there,
    I have wordpress 2.2 and installed nds-paste. Once I activated it, I lost the native 'visual’ editor in wordpress completely. This means that posts in edit mode are viewed as code. Any ideas how to fix? I’d understood that the Tinymce is the native rich text editor, so if 'rich text editor’ is turned on in my profile (as it is) it should still be on.

  • August 16, 2007 at 8:39 p.m. #
    Peter Baumgartner added:

    @Sophia
    You installed an old version that is not compatible with WP 2.2. Please see the link at the top of this post for a current version

Comments are closed for this post.

This was written on August, 31 2006 and is filed in code, wordpress.

Our Products

Premier Real Estate Websites
Our simple and easy real estate CMS. Now open for full developer access.
Trailmapping
Still in development, Trailmapping is a GPS enabled trail guide and trip logger.

Categories

Archives

Elsewhere

What we’ve been up to online

Interested in working with us?
Fill out the form below or contact us at:

PO Box 774441
Steamboat Springs, CO
80477

ph: 970.879.8810
fx:  970.367.8596
info@lincolnloop.com