• Resolved jimml

    (@jimml)


    FYI:

    I have been using the “paste from word” icon for the past two weeks in WordPress 2.5.1 because I write my posts in a word processor offline and paste them in later – this new device seemed quicker than using my usual word processor and then stripping out all the unwanted formatting code in the HTML editor.

    I use Firefox as my internet browser, so I was unaware of a problem until notified by a couple of subscribers: since switching to the “easier” “paste from windows” button in WP 2.5.1, many of my subscribers had not been getting text with their feeds – just the post title – and if they clicked through to the site and if their browser is Internet Explorer, they got the same thing: Blog title, post title, no text.

    It turns out this “paste from windows” system was inserting script in front of the posts that halted further printing of the material. I had to go back through all the posts for the past two weeks and strip it out. Once that was done, the site worked normally on IE again, and my subscribers tell me their feeds are normal also.

    I now use my original system of writing in another word processor (Star Office), but then I copy and paste to notepad and then back to Word Press.

    Just a heads up.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Had the same problem so dug into this a bit more. It seems to be a problem with the tinyMCE module itself and the way Firefox handles the paste.

    To fix this 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:
    https://tinymce.moxiecode.net/punbb/viewtopic.php?id=12385

    Hope this helps – I just submitted this as a bug on Trac.

    Thread Starter jimml

    (@jimml)

    I’ve implemented your solution – thanks!

    Now I’ll have to wait for the new problem with the editing window not letting me into the visual pane (even though it shows me as being there, it’s actually in the html pane) to see how it works.

    But I’m sure it will work fine – thanks again for your time, effort, and detailed explanation – much appreciated!

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Paste from Word’ is closed to new replies.