WordPress.org

Ready to get started?Download WordPress

Forums

TinyMCE Advanced
Paste from Word (14 posts)

  1. jt70
    Member
    Posted 3 years ago #

    I recently updated both WordPress and TinyMCE Advanced, and have run into a problem.
    I use Microsoft Word to write my blogs, and then the paste from word function to insert the article.
    Before the update, this process kept the formatting for specific words (i.e. bold, italics, color), but inserted everything else with just a clean 'P' tags. No it is adding in span tags with the font and size from wordpress, which overrides the CSS. Plus it takes a lot of effort to pull it all out, especially when an article is long.
    Is this just a configuration problem where a setting was reset, or did the functionality of the plugin change?
    Thanks-any help would save me a LOAD of work.
    Jeff

    http://wordpress.org/extend/plugins/tinymce-advanced/

  2. mjaning
    Member
    Posted 3 years ago #

    I am having the same problem you have reported. Even when pasting using the "Paste From Word" button the <span> tags with fonts are not cleaned.

    I have tested the CKEditor plugin for WordPress and it seems to work correctly removing all undesired formats but the basics (bold,italic, and so on).

    I did not find any documentation about reconfiguring tinyMCE to fix this issue after migration to WordPress v-3.1.

    Thanks,

  3. jt70
    Member
    Posted 3 years ago #

    I tried the CKEditor, and didn't like it much. It had a couple of times where it took out random spaces, and it adds in non-breaking spaces where I don't want them. Thanks for the recommendation, though, mjanning. I appeciate the help.

    I did try the internal WordPress editor with no plugins, and the paste from word function doesn't work like it used to without a plugin either. I suspect that the core changed something, as it doesn't appear linked to this plugin.

  4. mjaning
    Member
    Posted 3 years ago #

    I have found the source of the issue, it is in the editor_plugin.js which is located at \wp-includes\js\tinymce\plugins\paste\ folder.

    I returned all files in that folder from a previous WP version I have backed up, and the cleaning tag process is working again. In both ways, pasting straight to the text or using the Paste From Word button, the process is ok again.

    I also have opened a ticket for reporting this problem in the WordPress Trac. See the link http://core.trac.wordpress.org/ticket/17068

    I am not sure if the replacement that I did has impacts or if it has created other issues. So far everything is fine.

    Hope this can help.

    Marcelino,

  5. jt70
    Member
    Posted 3 years ago #

    Thanks a lot Marcelino.

    Looking forward to seeing this fixed in the next release. In the meantime, I'll be doing a lot of cutting and pasting.....

  6. mjaning
    Member
    Posted 3 years ago #

    As a temporary solution for those who are having the same problem, my suggestion is to clean up the Word text using some online tool, for example http://www.word2cleanhtml.com

    Simply copy your text from Word doc and paste in the text box of this tool. On the right there are checkbox fields, select the first 3 fields:

    - Remove Empty Paragraphs
    - Convert to <b> , <i> to 
    - Replace non-ascii characters with HTML entities
    

    Then click in the Convert to Clean button at the bottom of page.

    A new box will then appear with the text in HTML format already clean. Basic tags such as bold and italic are preserved.
    The next step is to copy this clean HTML text and paste in the WordPress Editor, but before pasting, you must change the Visual mode to HTML mode.

    I hope this procedure can at least mitigate the extra work the editor_plugin.js can cause since version 3.1.

    Sincerely,

    Marcelino

  7. jt70
    Member
    Posted 3 years ago #

    Marcelino,
    I tried that, and it seems to add in some random spaces. Otherwise it works good.

    Another alternative is to do a 'save as' file in word as an html (filtered) file, and then open it in an editor to paste in. It uses i instead of em, and converts ascii chararacters, but overall a decent workaround.

    Looking forward to the WordPress fix...
    Jeff

  8. mjaning
    Member
    Posted 3 years ago #

    Jeff,
    I think your suggestion in saving the file as HTML directly from the Word is a more convenient way to work.

    I have tried it over here and the results were pretty decent and also faster.
    At least WordPress users have now a very good source of information about this issue, and they have alternatives to continue working.

    Thanks to WordPress Forum.

    Now let's keep on eye in the WordPress Releases to get this issue fixed soon.
    Marcelino,

  9. mjaning
    Member
    Posted 3 years ago #

    Latest news...

    Core Trac WordPress team has reproduced the issue using one word file I sent them. See Core Trac Ticket

    The bug was forwarded to tinyMCE team for evaluation. See
    tinyMCE Ticket

    For fixing the word file, this is the recommendation from Core Trac team:
    "Copy all of the text from the problematic file, paste it into a new Word document, and then copy->paste that into TinyMCE, and it works (strips out all the cruft)"

    I have tried in my WordPress installation and it worked.

    Marcelino,

  10. Andrew Ozz
    WordPress Dev
    Plugin Author

    Posted 3 years ago #

    This seems to be a (rare) issue in the "paste" plugin for TinyMCE. Hopefully it will be fixed in the next version that will be in WordPress 3.2.

  11. jt70
    Member
    Posted 3 years ago #

    Marcelino,
    How did you get it to work? I wasn't sure what it meant by "text from the problematic file". Am I supposed to paste it into TinyMCE and then paste the html into word?
    I couldn't get the same success with this patch, and I tried a bunch of combinations.
    Jeff

  12. mjaning
    Member
    Posted 3 years ago #

    Jeff,
    Here are my steps for fixing the word file.

    1) Open your word file with your original text
    ... I am using a version of word 2007
    ... The original file I received was composed in a .doc format, I am not sure in which word version, maybe 2003.
    2) Create a new word blank document, preferred format is .docx
    3) Select all your original text in the original file and Copy it
    4) Paste into your new word file
    5) Save your new word file
    ...at this point, your new word file should not have problems anymore
    6) Now, select again the text from your new word file and Copy it
    ...certify that your copy command really worked, otherwise your clipboard still have the dirty text copied from your original file
    7) Go to WordPress editor and paste
    ... your WordPress editor must be in VISUAL mode (not HTML mode)
    ... you can paste directly into the body text or
    ... you can paste using the Paste From Word button
    8) Now switch the WordPress editor from VISUAL mode to HTML mode, just for checking the results
    ... your HTML code should be clean and without any <span style... tag inside.
    ... basic tags like <b> or or <p> or should remain in the text.

    After I have executed these procedures over here my new word file was really fixed, and I tried to paste the text in different WordPress installation I have (even in a blog at wordpress.com) and they all have worked.
    I hope you can replicate these steps and fix your word file as well.

    Marcelino,

  13. jt70
    Member
    Posted 3 years ago #

    just noticed that if I set the font to the same as in my stylesheet, and the size to 14 pts, my paste function seems to work correctly. On occasion, though, I still get some span tags with color around my hyperlinks. At least I have found a fairly efficient workaround.

  14. joneiseman
    Member
    Posted 3 years ago #

    I found this was a problem in TinyMCE to fix it I followed the instructions here: http://www.martinsikora.com/how-to-make-tinymce-to-output-clean-html
    To set this TinyMCE option in WordPress, I followed the instructions here: http://www.beanstalk.ie/blog/customising-the-tinymce-text-editor-in-wordpress/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic