views:

1385

answers:

5

I'm building a CMS in PHP and one dread I have is that the users will have to fill the data in from existing Word (and Excel, but nevermind that) documents. Now, I've seen what happens when they carelessly copy and paste from Word to a textarea: the database got filled with crap markup.

Now, I could certainly strip all markup myself, but I'd have to start learning about it first. So I ask you: have you tested some functionality - plugins of the usual suspects (tinyMCE, FCKeditor, etc) that helps here? Bonus for the least intrusive solution.

A: 

(Flagged for deletion)

Frans Bouma
I'm quite capable of googling, thanks. In fact, I found one answer already, but what I want to know about are experiences. That's why I asked 'Have you _tested_'. Unless Google is already doing that, too...
Adriano Varoli Piazza
The thing is, this particular problem has been solved years ago already as many CMS's had to solve this same problem. The best one you can pick is perhaps one which is truly server-side, though it might be harder find that one, as most editor components have this built in...
Frans Bouma
Really? that wasn't what I saw with the version of FCK used in the mentioned website.
Adriano Varoli Piazza
haha, i always get downvoted for the lmgtfy response
+2  A: 

Ok, I found a plugin for TinyMCE that apparently does what I wanted. Still, this asks for the users to press a button to paste, which is a bit less than ideal. Anything better?

Adriano Varoli Piazza
+2  A: 

I have found FCKEditor to handle text yanked and thrown at it from Word documents, much better than tinyMCE.

ayaz
The existing website I was talking about in the question already uses FCK, although not the latest version. Is it a recent improvement?
Adriano Varoli Piazza
@Moranar: I can't say. I am using version 2.6.3. It is just that when using tinyMCE, I found that it made it difficult to properly edit text copied from a Word document. FCKEditor, in contrast, did not have any of those issues.
ayaz
The paste from Word feature has been in for awhile. Not sure how long. It also auto-picks up the need to do Word pasting when a user uses the browser Edit->Paste or Ctrl+V.
Mufasa
+3  A: 

Sadly most of the HTML editor controls I've used either:

  1. Have a button to strip out various elements of mark up (word, html, script, etc)
  2. Strip out all markup on paste via JavaScript.

If you leave it to a button, then generally the non-technical users will forget to press it because they don't (some would say "shouldn't have to") care about it :(

With a bit of playing around with Regular Expressions (now you have another problem ;)) you could do something similar to 2 but just for word xml.

Zhaph - Ben Duguid
A: 

ASP.NET? Telerik's RadEditor has worked very well for me

Paul Nearney
Sorry, PHP (retagged now), but thanks.
Adriano Varoli Piazza