[wp-trac] [WordPress Trac] #27970: Images copy paste function not working in WordPress 3.9

WordPress Trac noreply at wordpress.org
Thu Aug 28 04:22:16 UTC 2014


#27970: Images copy paste function not working in WordPress 3.9
--------------------------+------------------------------
 Reporter:  tanzilahmed   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  TinyMCE       |     Version:  3.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------

Comment (by bitpath):

 For what it's worth, I fixed my issue by adding this code to a custom
 plugin,  but adding it functions.php should also work I think.  I also
 submitted a plugin but have not heard back yet.  I noticed the 3.9.2 added
 some image and copy paste functionality but it still did not give me this
 image capability in all browsers but the below code did.  It  If you just
 want the image line you  can delete out the webkit and retain styles, but
 it really helped me to copy and paste things from Office.  I just use the
 paste as text when I don't want all the style elements coming over.

 {{{
 /*** Adjust wordpress 3.9x+ editor to allow pasting images and other
 Office doc wysiwyg styles and 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);

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27970#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list