• Resolved beardedgit

    (@beardedgit)


    I was editing the source URLs for embedded images in existing posts (due to a forced change of photo-host), all was going well until the “upgrade” to WP3.9, since then I’ve been having problems with the Visual Editor code-stripping.

    Here’s an example…

    This:
    <p style="text-align: center;"><a title="" href="https://beardedgit.com/wp-content/uploads/872080579-2000x1329.jpg" target="_blank"><img onmouseover="this.src='https://beardedgit.com/wp-content/uploads/872081152-O-800x531.jpg';" onmouseout="this.src='https://beardedgit.com/wp-content/uploads/872080579-800x531.jpg';" alt="" src="https://beardedgit.com/wp-content/uploads/872080579-800x531.jpg" width="800" height="531" /></a></p>

    is stripped to this:
    <p style="text-align: center;"><a title="" href="https://beardedgit.com/wp-content/uploads/872080579-2000x1329.jpg" target="_blank"><img src="https://beardedgit.com/wp-content/uploads/872080579-800x531.jpg" alt="" width="800" height="531" /></a></p>

    As you can see, the onmouseover and onmouseout bits have gone. Moreover, with the latest incarnation of TinyMCE, there’s no easy way to put those bits back in.

    I’ve still got roughly 3000 image URLs to edit, they’re spread over about 1000 posts, and now every post edit is a nightmare instead of a simple yet boring admin job.

    So, is there any way to stop the latest WP/TinyMCE from mangling my posts?

    Cheers for looking, all help appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter beardedgit

    (@beardedgit)

    FWIW, I had my host restore a full backup (dated 10th April), now I’m back on WP 3.8.3 and everything is usable again.

    I’ll mark this topic as “resolved” because, although issues remain concerning the version of TinyMCE bundled with WP 3.9, I’m fine with my workaround.

    Hi

    I had something similar with one of my plugins that fired a javascript on a right onmouseup on an image.

    I managed to rewrite it so that I set an image class and then used jquery attached to the image class to fire the javascript.

    It’s not as direct as just adding the onmouseup code to the imag attributes but it works.

    You could look at doing something similar?

    Kevin

    Thread Starter beardedgit

    (@beardedgit)

    Thanks for the advice, Kevin. Glad you’ve found something that works for you.

    For myself, I like the simplicity of just pasting in the two required image URLs when setting up a mouseover, as per my screenshot at https://beardedgit.com/wp-content/uploads/2014%20Misc/oldtinymce.jpg

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Visual Editor is stripping code’ is closed to new replies.