It doesn't look like the "Force cleanup on standard paste" option does anything at all when enabled on the CKeditor library. This option is referred to as "paste_auto_cleanup_on_paste" in code, but is not referenced anywhere in the ckeditor.inc file (unlike the fckeditor.inc and tinymce.inc files).

This patch adds the proper filter options (since CKeditor 3.1) if this option is enabled.

CommentFileSizeAuthor
wysiwyg_ckeditor_cleanup.patch780 bytesquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

Status: Needs review » Closed (won't fix)

I looked through the plugin code when writing that implementation and I'm pretty sure pasteFromWordRemoveStyles and pasteFromWordRemoveFontStyles do not affect if a forced cleanup is done or not. That only happens if the pastefromword command is issued (via the PasteFromWord button), or if the content matches the RegExp /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/ while the pastefromword plugin is active.

So, it already does a cleanup if Word content is detected, there doesn't seem to be a way to always force one (other than using the PasteFromWord button) and those settings only affect how that cleanup is done, not when.

These options can be set via hook_wysiwyg_editor_settings_alter() until we get #313497: Allow configuration of advanced editor settings in. (One of the many things I'll try to work on when I get back from my vacation.)

quicksketch’s picture

Status: Closed (won't fix) » Needs review

I'm pretty sure pasteFromWordRemoveStyles and pasteFromWordRemoveFontStyles do not affect if a forced cleanup is done or not.

I tried out these settings before and after the patch, it does indeed affect all pasting, whether or not using the dialog. Try it out!

quicksketch’s picture

Status: Needs review » Needs work

Hmm, I may be misled on this. I'm going to take another look at it and post back later. Clearly the checkbox doesn't do anything though. If the cleanup is currently "automatic" it should be not cleaned up if the checkbox is not checked.

TwoD’s picture

Ok. Yes, the checkbox doesn't do anything (and I would have removed it for CKEditor to avoid the UI confusion - but can't do that properly before #313497 is solved).

The cleanup is only automatic (and not possible to turn off, as far as I can see) if the RegExp above finds a match (during a regular paste event) and the word plugin is active, or if the PasteFromWord button was used (a forcecleanup flag is set). That will trigger the filter plugin to do its thing, and how much it removes depends on the two options used in the patch.

hixster’s picture

Component: Editor - CKeditor » Code

I've just added this :

       $settings['pasteFromWordPromptCleanup'] = TRUE;

To my own custom CKEditor settings module and it auto detects word and displays a message to the user when they paste in, it then cleans up the markup.
Works a treat!

TwoD’s picture

Status: Needs work » Closed (won't fix)

Please follow #1963766: Improve support for paste related options for the current status of support for paste related settings.
Even though I mark this a "won't fix", the code put here could easily be included in the patch for the other issue. It isn't yet, but the other patch isn't final yet either.