Paste From Word
-
I’m honestly not sure if this is a problem with the plugin or the new TinyMCE version, but since I wasn’t able to paste from Word/OpenOffice before installing this, I imagine it belongs here.
Anyway, after updating, the Paste From Word button is gone. Paste As Text now appears to be a toggle between this and pasting as text, but the generated code is a mess that removes all my spacing. This didn’t happen before the update.
I’m not so much concerned with the ugly code as the loss of spacing. It seems to be ignoring or removing both paragraphs and /br tags. It looks fine in the Visual Editor, but not in the published doc.
-
I have a client (fiction author) who is being driven to all caps distraction by this. Pasting directly from Word 2010 regularly deletes spaces between words, deletes single word paragraphs altogether.
She’s been doing her blog this way since 2008 and we’ve NEVER had a problem pasting from Word until this upgrade.
I have replicated this problem on a test blog with the 2014 theme and no plugins. Other people have replicated it on her blog.
Interestingly, one tester reported that she didn’t get that problem on WordPress.com.
I have tried upgrading to the latest version of tinymce but that seems to have its own issues – the toolbar in the Visual editor simply disappears. I don’t have the patience to troubleshoot.
It’s frustrating to read ‘it works’ over and over when there are obviously people who are having serious issues.
Working or not working. Since WP 3.9 I have definitely noticed that the issues with paragraph and line spacing hasbecome worse.
NO matter who it is working for, there are enough people having a problem with it, that makes it worth looking into fixing.
For me that is probably the biggest issue that speaks against using wordpress for building sites. Although I absolutely love it, but if it takes 2 to 3 hours just fixing spaces and paragraphs for one page, I need to consider a cms that lets me progress faster.
I hope that issue is fixed very soon, as I really love WP and would hate to have to change.
I see that nobody has written on this in a while, so I’m hoping someone has found a solution. Perhaps someone can tell me how to roll back to a previous version of WordPress if there is no other way?
I find it wildly insulting that so many people in the thread just blindly insist it is working in the face of so many who are complaining that it doesn’t. If the public can’t make it work, it’s broken.
Inability to post from Word as I used to is essentially fatal to my site so I’d appreciate any advice.
Sorry. Been really busy but getting back to reviewing the possibility of a plugin.
For now, please try adding this to your functions.php to see if it helps.
After looking things over it seems like it was default configuration issues. The below code should enable image copy paste from clipboard, formatted copy/paste from word and excel. It’s a bit of a “nuclear option” just enabling all the wysiwyg copy/paste I could think of for now, and I’ll try to get a more refined solution here soon. Also, i’m still learning so I apologize for any crudeness to the code.
Please note this was just what I did to fix my issues with the new editor that may or may not be related to your issue. I really hope it helps your situation some though.
It’s just to enable copy/paste of images and other style elements by default. If you don’t want any style elements, paste as text should still work./** * Adjust wordpress 3.9x+ editor to allow pasting images and other office document wysiwygy elements */ function enable_tmce_paste_stylesAndImages($mceInit, $editor_id){ $mceInit['paste_data_images'] = true; $mceInit['paste_word_valid_elements'] = "b,strong,i,em,h1,h2,p,ol,ul,li,a,span,div,font-size,br,img,table,tbody,td,tfoot,th,thead,tr,del,ins,dl,dt,dd"; $mceInit['paste_webkit_styles'] = "all"; $mceInit['paste_retain_style_properties'] = "all"; return $mceInit; } add_filter('tiny_mce_before_init', 'enable_tmce_paste_stylesAndImages', 1, 2);
@bitpath this pretty much disables the cleanup on paste. Would still work ok in Firefox and IE but will insert tons of bad markup in Chrome/Safari.
I totally get that it disables the cleanup.
I really dig your plugin by the way.
TinyMCE default cleanup was way too restrictive for me, preventing me from pasting screen print images, excel tables and other elements. I’d rather paste as text (cleaned up) when I want or use the little eraser.
I appreciate the warning about pasting bad code from IE and Firefox and feel mileage will vary on that one. For some just being able to copy and paste images from clipboard or certain elements from Word/Excel might be more important to workflow than the underlying code being pretty. I don’t mind it encoding images right in the HTML in a pinch to paste a quick screenshot, but realize it might make some cringe :). I use mostly Firefox and Safari and switch back and forth wysiwyg and text modes often and haven’t noticed a lot of extra markup in my normal usage, but will keep an eye out.
Thank you for a great plugin!I’d prefer a “paste all wysiwyg” button to selectively enable these elements and bypass default filtering only if needed, but with my limited skill-set, disabling the cleanup as much as I could think of solved my current need.
Hmm, a button is not a bad idea, not sure if it can be done right though. Resurrecting the old popup is another alternative. Then the level of cleanup can be selected in the popup. It can even be made to show a preview of the HTML that is going to be inserted.. All that is for advanced users, of course.
That would be really cool!
Thank you Bitpath, you are the man of the day!
I hope a solution to this can be found by WP coders and make it offical in following releases.
Ozz is already considering how to best implement something like this, and he’s the true TinyMCE guru here. I know just enough to fiddle. There are potential problems with my workaround, sometimes bringing over undesired styles or messy code, especially for end users not comfortable reviewing text mode or using the format eraser.
I look forward to however he sees best to give a few more filter options! This really isn’t the best default config for many, disabling all the cleanup by default, it’s just easier for my current workflow. Thank you so much and glad it helped!I update a small, monthly school bulletin/blog and material is provided in Word by students so ability to be able to copy images and paste them directly into the post is a time saver and I do try to clean code by pasting into a text editor before I insert into post. I am sure I am not the only one receiving material in Word so I do hope a solution is found and not take away features from WP.
Ozz may be the guru but this week you are MY guru *lol* thanks a bunch, once again!! …yes, it certainly did help ??
Good luck Ozz, in finding a solution, ability to paste images from Word is a “must have” feature to develop/implement/keep.
For now added another checkbox to turn pasting of image sources on ??
Not a good solution, don’t like having tons of checkboxes/settings that most users don’t care about, but making this in a TinyMCE plugin with a popup is not an easy task.
Thank you for adding that!
I agree, too many options in your face is clutter, especially small use case ones.
I was thinking more of a single “fine, let it all through then” option at first, to let as much as possible come through to help troubleshoot various issues, like missing charts, pictures, empty paragraphs, styles, etc., and then switching to html to see what it was coming over as to see what was being blocked. That’s how I’d use it, but I don’t know how many people would make use of that or just be lazy leaving it all unfiltered and leaving a crazy mess of code in their wake.
Well, thank you again. Even without any more options your plugin is quite a help as-is. thank you also for explaining the implications of string encoding the clipboard images right next to the option!! I’m wondering if the “stop removing p and br tags…” option will help people reporting empty paragraphs and line breaks disappearing after the update. If that options was already there I hope people will take a second look at it too!I’m glad you like it.
I couldn’t fully test enabling this for “paste from word”. Added
paste_word_valid_elements
and as far as I see it works: https://plugins.trac.www.ads-software.com/browser/tinymce-advanced/trunk/tinymce-advanced.php#L406Another test/confirmation would be helpful for that ??
- The topic ‘Paste From Word’ is closed to new replies.