Folks,
My company needs to support the following workflow: - There's rich content getting created in Google Docs (with simple formatting - bold/italic, as well as hyperlinks) - That content is then pasted into an internal CMS that uses TinyMCE.
Problem: all formatting gets lost when pasting stuff in.
Already tried the "paste from Word" plugin - it doesn't work.
Please advise. Thank you!
UPDATE: I narrowed the problem down to Google Chrome. Firefox works just fine. I also used the paste_pre_processing() callbacks - the data gets corrupted before getting in there.
I ended up giving up on the Paste plugin into TinyMCE. Instead, I used the undocumented valid_styles property of TinyMCE. This solved the problem fine for my scenario. Here's the config snippet we ended up using:
valid_elements: "a[href|title|target],del,b,strong,del,i,blockquote,p,br,em,ul,li,ol,span[style]",
valid_styles : { '*' : 'font-weight,font-style,text-decoration' },
I know this question was asked a long time ago however I am making an application that requires a copy and paste from google drive into tiny mce. This is actually fairly simple with the free paste plugin. Simply remove the filters so that it can copy in all of the data.
tinymce.init({
selector: 'textarea',
plugins: "paste",
paste_data_images: true,
paste_enable_default_filters: false,
paste_remove_styles_if_webkit: false
});
Your problem is a somewhat complex issue.
First you need to make sure that tinymce does not remove tags and tag-attributes that it recognises as invalid (have a closer look at the tinymce configuration options valid_elements and valid_children).
Second you will have to implement an own handling of the paste process. There are three way to do this. The most time consuming option is to write an own custom paste plugin and replace the given one. The other options are ways to configure the paste plugins and define own functions to interact with and change the pasted content. The seetings paste_pre_processing and paste_post_processing are the way to go here.
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