Jump to content

TinyMCE - Paste as plain text by default?


bcartier
 Share

Recommended Posts

I'd like to request that TinyMCE be configured to paste as plain text by default. This tends to save a lot of headaches with special characters coming in from Word and reduces support calls about the WYSIWYG ;-)

It doesn't seem like something I can override in the admin theme, but if I'm wrong please let me know the secret...

I found this example on stack exchange on how to do it:

tinyMCE.init({
...
plugins : "paste",
paste_text_sticky : true,
setup : function(ed) {
ed.onInit.add(function(ed) {
 ed.pasteAsPlainText = true;
});
}
....
})

Thanks!

  • Like 2
Link to comment
Share on other sites

In the Field setting screen of a TinyMCE field you can configure much if not everything. Tab "Input" you see the TinyMCE Advanced Configuration Options.

Add "paste" to the plugins string.

Add

paste_text_sticky: true
paste_text_sticky_default: true

to the Additional TinyMCE Setting field.

If you want to add it globally to al TinyMCE fields you could add following to the default.php in your admin theme.

Before closing </head>


<script>
// overwrite TinyMCE skin setting globally
// as defined in /wire/modules/Inputfields/InputfieldTinyMCE/InputfieldTinyMCE.js
// and loaded before
if('undefined' != typeof InputfieldTinyMCEConfigDefaults) {
 InputfieldTinyMCEConfigDefaults.plugins += ",paste";
 InputfieldTinyMCEConfigDefaults.paste_text_sticky = true;
 InputfieldTinyMCEConfigDefaults.paste_text_sticky_default = true;
}
</script>
  • Like 2
Link to comment
Share on other sites

I agree with bcartier, this should be the default behavior. I know that I can use ctl+shift+v, but try telling that to your clients :)

In this case, there could be a button to paste with formatting

Link to comment
Share on other sites

Thanks Soma, that's a great solution.

I tried out the field settings as you suggested and it works perfectly. I have yet to try the admin theme change but that should do the trick for future sites. If not the pw default, at least I can make it my own default :) .

Thanks again for you help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...