Page 1 of 1

Implementing a better paste cleanup?

PostPosted: Fri Sep 18, 2009 3:41 am
by johnpitcairn
I'm transitioning a client's Drupal site from widgEditor to WYMedit/wysiwyg, and now have things mostly how I want them. Drupal throws in a few extra curves to negotiate if you want to customize the editor without resorting to hacking the source.

But getting clean input on paste is a problem, because editors WILL just paste directly into the editor rather than using "paste from word". They won't notice the awful result (really!). There's a preference in the Drupal wysiwyg prefs for WYMeditor that should force "normal" paste to behave like "paste from word", but this doesn't appear to work reliably.

I have a set of regexp functions I was using in widgEditor which aggressively strip out all tags and other junk I don't want. I would like to look into adding those as an "auto-cleanup" plugin for WYMeditor that tries to detect a paste then processes the result. Where should I be looking to hook this in?

Note I don't especially care if paste-detect won't work in Firefox, I can specify that IE or Safari must be used to edit.

Re: Implementing a better paste cleanup?

PostPosted: Fri Sep 18, 2009 4:01 am
by johnpitcairn
Heh. The Drupal preference to force cleanup on a direct paste does work ... at least it does in IE Windows. I guess it's detecting Control-V and Shift-insert?

While I'm OK with requiring IE my client to edit, it might be nice to extend paste-detection to detect Command-V for Mac users ... possible?

Re: Implementing a better paste cleanup?

PostPosted: Mon Oct 05, 2009 8:04 am
by mantis
An option where one could set the default behaviour of the editor when dealing with pasted content would be nice. :) If you paste content into the editor it either strips out unwanted code automatically or it doesn't. :)

Re: Implementing a better paste cleanup?

PostPosted: Mon Oct 05, 2009 4:11 pm
by mr_lundis
Hello!
Take a look at what we've said in this discussion. You cold try to insert your clean up regexs before/after the update or html methods and then post whatever works best here as a plugin.

Cheers! ;)

Re: Implementing a better paste cleanup?

PostPosted: Wed Nov 25, 2009 11:28 pm
by johnpitcairn
I'll be taking another look at this in the next few days, thanks.

Any comments about paste-detection for Mac users?

Re: Implementing a better paste cleanup?

PostPosted: Fri Nov 27, 2009 5:49 pm
by Folken Laƫneck
You could force the paste dialog to open with just a small plugin like this one I wrote