This issue replaces or follows-up on some older issues in order to better coordinate them:
#474588: 'Force cleanup on standard paste' not working
#776278: Toggle paste as plain text does not work
#875404: "Force cleanup on standard paste" does not do anything with CKeditor
#1762462: Unable to force cleanup on standard paste

The only editors having paste-related options are TinyMCE, FCKeditor,and CKEditor. I've search through all other supported editors and from what I can tell, no other editors have options affecting how content is treated when pasted. Other editors are known to have buttons/commands for pasting via a toolbar or context menu, but there are no known ways to change its behavior.

What this patch does

TinyMCE

  • Renames the "Force cleanup on standard paste" setting to "Process contents on paste" and changes the description to better clarify that no paste related processing will be done unless this is enabled.
  • Allow to change the 'paste_text_sticky' setting via a 'Sticky "Paste Text" button' checkbox
  • Allow to change the 'paste_text_sticky_default' via a 'Paste as plain text by default' checkbox - essentially makes the "Paste text" toolbar button enabled by default. Note: This is the closest you get to "forcing plain text" you get using simple settings tweaking.
  • Added widgets for 'paste_block_drop', 'paste_retain_style_properties', 'paste_strip_class_attributes', 'paste_remove_spans', 'paste_remove_styles', 'paste_remove_styles_if_webkit', 'paste_convert_middot_lists', 'paste_convert_headers_to_strong', 'paste_max_consecutive_linebreaks', 'paste_text_use_dialog', 'paste_text_sticky', 'paste_text_sticky_default', 'paste_text_notifyalways' and 'paste_text_linebreaktype'.
  • Some of the above are enabled by default in the profile configuration GUI to reflect actual editor defaults.

FCKeditor

  • Allow to change the 'AutoDetectPasteFromWord' setting via a "Auto detect paste from Word" checkbox. Enabled by default in the Wysiwyg GUI to reflect it's default state in the FCKEditor library.
  • Allow to change the 'ForcePasteAsPlainText' setting via a "Force paste as plain text" checkbox (Disables Word cleanup)
  • Updates existing FCKeditor profiles and renames the 'paste_auto_cleanup_on_paste' setting to 'ForcePasteAsPlainText', if it's been previously set.

CKEditor

  • "Force paste as plain text" now toggles the 'forcePasteAsPlainText' setting instead of using 'paste_auto_cleanup_on_paste' internally (TinyMCE-specific internal name which didn't actually reflect what it did. It's actually only used in the current -dev snapshots.)
  • Updates existing CKEditor profiles and renames the 'paste_auto_cleanup_on_paste' setting to 'forcePasteAsPlainText', if it's been previously set.
  • Adds widgets for 'pasteFromWordNumberedHeadingToList', 'pasteFromWordPromptCleanup', 'pasteFromWordRemoveFontStyles' and 'pasteFromWordRemoveStyles' for CKEditor => 3.1.0.
  • Some of the above are enabled by default in the profile configuration GUI to reflect actual editor defaults.

Others

  • The "Force cleanup on standard paste" checkbox will no longer show up in the GUI since it has been moved to the TinyMCE implementation.

Thoughts

  • Add new 'editor defaults settings callback'-callback for editor definitions, and eventually 'settings defaults callback' for plugins (needs 'settings form callback' first), to avoid storing a really large JSON object and passing lots of settings to the client which do not actually override defaults.

Comments

Looking forward to the patch! :)

Status:Active» Needs review
StatusFileSize
new21.45 KB

Here you go. :)

It's a pretty big patch with lots of potential for typos so I probably missed something here and there.
The setting descriptions are taken from the official editor documentations where available, reverse engineered from source where needed and reworded to [hopefully] make more sense to Drupal/Wysiwyg module users.

Issue summary:View changes

Updated issue summary with additional changes.

Patch working great for me.

This is very much appreciated. I told my boss this was possible then discovered it wasn't working. I will be happy to tell her it's working now! :D

StatusFileSize
new21.46 KB

Thank you very much for the patch. You're right, there's a lot of potential for typos ;):

  1. the big one: in your update function, you're correctly unserializing the settings array, but don't use it. This causes an error during update, failing to complete it - only if it would really change something in the DB
  2. the small one: you wrote "Promt on cleanup" instead of "Prompt on cleanup"

Attached the modified patch that addresses both issues

best regards,
Andi

Thanks agoradesign! This is exactly why I try to always post a patch before committing anything!

I've decided to perform a general cleanup of the settings form and move all editor-specific settings out to the individual integrations and later rebase this patch on that. I've done most of it already but I'm not quite done. That first patch will take care of removing unused settings (including those removed by this patch) and performing the internal renaming update. This patch will then focus on just adding the new paste settings widgets for each editor. I'll post a link here when that patch is up. (I work this weekend and then I go on vacation so I'll have more time to spend here).

Would this patch work for 6.x-2.x-dev as well?

thank you.

I don't think it'll apply cleanly as-is, but I do plan to backport to D6 soon after D7 is done. No plans for D5.

What's the status here? Would love to test this as this is an annoying as heck problem.

Status:Needs review» Needs work

This needs a re-roll since #2018439: Move editor-specific options out of the default profile UI. got in, sorry I forgot to post the link to that issue earlier. And guess what, "vacation" appears to mean you get even less time over when you're a house owner. Should have seen that one coming... Anyways, I'm back at work now, both on the job paying my bills and work here. I'll reroll this when I'm back home unless someone beats me to it.

Issue summary:View changes

Tag typo fix.

Status:Needs work» Needs review
StatusFileSize
new14.91 KB

Rerolled against current 7.x-2.x.

The update function is no longer needed since #2018439: Move editor-specific options out of the default profile UI. took care of all that for us. That update hook does not explicitly remove old paste-related options from all existing profiles where they aren't used, but they will be skipped when those editor profiles are saved again anyway.

Tested new patch. It applied cleanly and everything still working. The error during update went away.

Issue summary:View changes

Removed irrelevant point.