Forum closed. New forum available at http://community.wymeditor.org/

Implementing a better paste cleanup?

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:
http://trac.wymeditor.org/

Implementing a better paste cleanup?

Postby johnpitcairn on Fri Sep 18, 2009 3:41 am

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.
johnpitcairn
 
Posts: 6
Joined: Fri Sep 18, 2009 3:18 am

Re: Implementing a better paste cleanup?

Postby johnpitcairn on Fri Sep 18, 2009 4:01 am

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?
johnpitcairn
 
Posts: 6
Joined: Fri Sep 18, 2009 3:18 am

Re: Implementing a better paste cleanup?

Postby mantis on Mon Oct 05, 2009 8:04 am

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. :)
mantis
 
Posts: 11
Joined: Fri Jun 29, 2007 1:50 pm
Location: South Africa

Re: Implementing a better paste cleanup?

Postby mr_lundis on Mon Oct 05, 2009 4:11 pm

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! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: Implementing a better paste cleanup?

Postby johnpitcairn on Wed Nov 25, 2009 11:28 pm

I'll be taking another look at this in the next few days, thanks.

Any comments about paste-detection for Mac users?
johnpitcairn
 
Posts: 6
Joined: Fri Sep 18, 2009 3:18 am

Re: Implementing a better paste cleanup?

Postby Folken Laëneck on Fri Nov 27, 2009 5:49 pm

You could force the paste dialog to open with just a small plugin like this one I wrote
Folken Laëneck
 
Posts: 13
Joined: Wed Jan 07, 2009 12:08 am


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest

cron