Search code examples
tinymcecopy-pastegoogle-docs

TinyMCE: Copy-Paste from Google Docs


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.


Solution

  • 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' },