1

I have spent 2 days on google but have not been able to find a working answer for V4 of TinyMCE.

I am using the latest CDN version of TinyMCE in my project and i am after a way to not only paste as plain text but to remove everything except minor things like <p> and <br/>. I have a problem with pasting in items and bringing baggage like <div>.

The current working version is based of this answer https://stackoverflow.com/a/9050597/1917125.

<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>

<script>
    tinymce.init({ plugins : 'paste',
    paste_auto_cleanup_on_paste : true,
    paste_remove_styles: true,
    paste_remove_styles_if_webkit: true,
    paste_strip_class_attributes: true,
    selector:'input#tinymce',
    height: 400,
    menubar : false, 
    toolbar: "undo redo | bold italic | 
    alignleft aligncenter alignright alignjustify | 
    bullist numlist outdent indent "});
</script>

This works in removing all visual elements, but i need to do one better and remove elements like <div> from a CTRL-V paste.

Thanks in advance.

Community
  • 1
  • 1
Rohan Peters
  • 147
  • 1
  • 1
  • 14

1 Answers1

0

Try this :

valid_elements: "p,br,b,i,strong,em",

Check this out here:

http://www.tinymce.com/wiki.php/configuration:valid_elements

Shail Paras
  • 1,125
  • 1
  • 14
  • 34