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.
Comment | File | Size | Author |
---|---|---|---|
#16 | improve_paste_options-1963766-16.patch | 14.43 KB | BWPanda |
Comments
Comment #1
Sarenc CreditAttribution: Sarenc commentedLooking forward to the patch! :)
Comment #2
TwoDHere 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.
Comment #2.0
TwoDUpdated issue summary with additional changes.
Comment #3
Sarenc CreditAttribution: Sarenc commentedPatch 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
Comment #4
agoradesign CreditAttribution: agoradesign commentedThank you very much for the patch. You're right, there's a lot of potential for typos ;):
Attached the modified patch that addresses both issues
best regards,
Andi
Comment #5
TwoDThanks 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).
Comment #6
dawnbuie CreditAttribution: dawnbuie commentedWould this patch work for 6.x-2.x-dev as well?
thank you.
Comment #7
TwoDI 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.
Comment #8
dddave CreditAttribution: dddave commentedWhat's the status here? Would love to test this as this is an annoying as heck problem.
Comment #9
TwoDThis 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.
Comment #9.0
TwoDTag typo fix.
Comment #10
TwoDRerolled 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.
Comment #11
Sarenc CreditAttribution: Sarenc commentedTested new patch. It applied cleanly and everything still working. The error during update went away.
Comment #11.0
Sarenc CreditAttribution: Sarenc commentedRemoved irrelevant point.
Comment #12
BWPanda CreditAttribution: BWPanda commentedHere's an updated patch for the latest dev version (applying the last patch failed for me).
Could someone please explain what the difference is between the following TinyMCE buttons/plugins (I'm using version 3.5.8)?
Which do I need to use for this functionality?
Comment #13
BWPanda CreditAttribution: BWPanda commentedSame as #12 patch, updated for latest dev.
Comment #14
gmclelland CreditAttribution: gmclelland commentedThe patch in #13 works for me with TinyMCE 3.5.8. Thanks everyone. I would set this to RBTC, but I'm not using CKeditor or FCKeditor.
Comment #15
gmclelland CreditAttribution: gmclelland commented@BWPanda - On your wysiwyg profile, enable the Paste text and Paste from Word plugin. Save the profile and reedit the profile. There should now be a "Paste plugin" vertical tab with options.
If you want plain text to be the default, choose the following options:
Hope that helps
Comment #16
BWPanda CreditAttribution: BWPanda commentedUpdated patch for latest dev.
Comment #17
Chris CharltonCool, so where do we want to take this? It's been 1-2 years since any patches/changes.
Comment #19
TwoDThank you all for helping with this!