Opened 14 years ago
Closed 14 years ago
#7445 closed defect (bug) (invalid)
Paste from Word in Firefox incomplete
Reported by: |
|
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.
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.