[wp-trac] [WordPress Trac] #7445: Paste from Word in Firefox incomplete

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 31 18:57:47 GMT 2008


#7445: Paste from Word in Firefox incomplete
----------------------+-----------------------------------------------------
 Reporter:  jamielob  |       Owner:  anonymous
     Type:  defect    |      Status:  new      
 Priority:  normal    |   Milestone:  2.7      
Component:  TinyMCE   |     Version:           
 Severity:  normal    |    Keywords:           
----------------------+-----------------------------------------------------
 When using the "Paste from Word" function within tinyMCE in Wordpress 2.6,
 some code is left at the start of the content which causes the page to
 break when viewed in IE7.

 I have fixed this by doing the following

 Go to:
 wp-includes/js/tinymce/tiny_mce_config.php

 Scroll down to find // TinyMCE init settings at line 135.  At the bottom
 of the initArray add

 `'paste_insert_word_content_callback' => 'convertWord'`

 don't forget to add a comma on what was the last item in the list:

 `'old_cache_max' => '1', // number of cache files to keep`

 Now go to:
 wp-includes/js/tinymce/tiny_mce_ext.js

 and add the following to the bottom of the file:

 `function convertWord (type, content) {
     switch (type) {
         // Gets executed before the built in logic performs it's cleanups
         case "before":
             //content = content.toLowerCase(); // Some dummy logic
             //alert(content);
             break;
         // Gets executed after the built in logic performs it's cleanups
         case "after":
             //alert(content);
             content = content.replace(/<!(?:--[\s\S]*?--\s*)?>\s*/g,'');
             //content = content.toLowerCase(); // Some dummy logic
             //alert(content);
             break;
     }
     return content;
 }`

 Now simply clear your cache (you can delete the file in wp-
 content/uploads/js_cache) and it should work!

 I adapted this solution from this page:
 http://tinymce.moxiecode.net/punbb/viewtopic.php?id=12385

 Hope this helps.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7445>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list