WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#7445 closed defect (bug) (invalid)

Paste from Word in Firefox incomplete

Reported by: jamielob Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords:
Focuses: Cc:

Description

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.

Change History (2)

comment:1 azaozz6 years ago

This seems to be a problem with the "paste" plugin in TinyMCE. It leaves one html comment at the top. Passing on to the TinyMCE developers.

comment:2 jacobsantos6 years ago

  • Milestone 2.7 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Not WordPress issue.

Note: See TracTickets for help on using tickets.