Pasting images removes class attribute

When you paste an image with a class attribute in the Wysiwyg editor, the pasted image no longer has this class attribute.

This makes it harder to copy and paste images that are aligned with the alignleft or alignright classes.

This used to work in WordPress 2.7, but it no longer works in WordPress 2.8 and up. It also works in the “base” version of TinyMCE (tested with 3.2.7 and 3.3.9.3), so it is probably something that is added by WordPress. I tested this in Safari, Firefox 3.6 and Chrome on Mac OS X.

This has been mentioned in a Trac ticket but the main item was dismissed as a browser issue – but I think the class issue is not.

Has anyone else found a way to make this work?

1 Answer
1

Instead of pasting into the Visual editor, switch to the html editor for pasting any kind of html, or using shortcodes.

I’d recommend checking the “disable the visual editor” checkbox in your user profile. Then install Mark Jaquith’s Markdown on Save plugin for more readable formatting without the wysiwyg pitfalls.

Leave a Comment