When I copy and paste a text from a text edit, or webpage, it pastes a lot of junk like the font size, color, font family like [div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "]
I see the button to paste and remove the formatting from word.. but it does the same thing even when I copy some text inside this wysiwyg. I use a mac... any way to fix this problem?
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
Try using the Paste as Plain Text dialog.
-
-
yes I can do that.. but I was wondering if there was another way..
because for example today I copied a block of text with a picture and h2 inside the wysiwyg, when I pasted I have all the messy code that I had to remove from the source view. -
-
If it helps, I've edited the following file: extensions/fieldtypes/wygwam/lib/ckeditor/config.js
And set the following:
config.pasteFromWordIgnoreFontFace = true;
config.pasteFromWordRemoveStyle = true;
config.pasteFromWordKeepsStructure = true;
config.forcePasteAsPlainText = true;
The bottom one being the most important - now whenever I paste anything into the text box, it prompts with a panel to paste it into and cleans out all the bits.
Although, with Macs, I've noticed some of the spans still get through.- view 1 more comment
-
-
Yes – in Wygwam 2, CKEditor is now located it themes/wygwam/lib. However most of the settings are also accessible right from your field settings now (the "Add an Advanced Setting..." drop-down).
-
-
This is *fantastic*. Thank you, Brandon.
-
-
-
-
The config code from Peter worked great, but with the new 1.1.5 when I paste inside the text area nothing happen.. It should pop up the windows where to paste the text.. if I keep paste multiple times anyway and I look the source code I see a bunch of [textarea id="cke_pastebin"> [/textarea]
any idea? -
-
I'm currently getting hammered by clients who are copying and pasting from Word - the field is containing all sorts of horrible 'HTML' from the Word formatting.
Thanks Peter for sharing that code above - I'd prefer it if it just pasted it as plain text without the popup (or if it converted Word formatting into nice HTML using magic!), but it's certainly a step forward for me. -
-
I tried the code above posted by Peter, and I'm still getting font color tags in the code. Any solutions for this?
-
-
This doesn't natively strip out every tag - I had some problems still with content pasted on the Mac with lot's of span tags. So I'm now using the autoclean plugin. Although bear in mind, this cleans it on save I believe not on paste.
Copy the code shown on the url above into a new file (appropriately named) and placed in \themes\wygwam\lib\ckeditor\plugins\autoclean folder (create the last folder).
In your config.js (\themes\wygwam\lib\ckeditor folder) add:
config.extraPlugins = 'autoclean';
...to the following function:
CKEDITOR.editorConfig = function( config ) {
Then you can tweak the plugin.js in autoclean to ignore or include markup as you require. -
Loading Profile...



EMPLOYEE


