I am having a little trouble with my inline text editor. it is simple user has permission to copy paste on the textarea div. no problem with that. but i dont want let them paste html with images, and div elements.
I have used
valid_elements: "p,br,b,i,strong,em",
it removes the style of p tags content.
to do this but this is not the solution according to my requirements.
and i also tried with paste_postprocess but it didn't do anything with latest version of tinymce.
and i have also tried many solutions which are already posted in this community. but none of them work for me because i am using the latest version tinymce 4.0.26.
i know i can prevent copy paste by disabling right click. but that will not be a good idea.
Is there any way to filter only p tag with style from html content?
So if anybody has worked on copy paste with the latest versions of tinymce.
Please help.
You need to explicitly tell TinyMCE what attributes to keep when using the valid_elements option. For example, using your previous valid_elements list, you might do something like this:
valid_elements: "p[style],br,b,i,strong,em"
This tells TinyMCE to only keep the tags listed and to keep any style attributes defined for p tags. Alternatively, you can also include all attributes for a specific element by doing this:
valid_elements: "p[*],br,b,i,strong,em"
Again, this tells TinyMCE to keep all of the tags listed, but for the p tag, keep every attribute defined.
For more information on the syntax of this valid_elements selector, check out this page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With