WordPress.org

Forums

[resolved] Visual Editor is stripping code (4 posts)

  1. beardedgit
    Member
    Posted 1 year ago #

    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="http://beardedgit.com/wp-content/uploads/872080579-2000x1329.jpg" target="_blank"><img onmouseover="this.src='http://beardedgit.com/wp-content/uploads/872081152-O-800x531.jpg';" onmouseout="this.src='http://beardedgit.com/wp-content/uploads/872080579-800x531.jpg';" alt="" src="http://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="http://beardedgit.com/wp-content/uploads/872080579-2000x1329.jpg" target="_blank"><img src="http://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.

  2. beardedgit
    Member
    Posted 1 year ago #

    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.

  3. kevin heath
    Member
    Posted 1 year ago #

    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

  4. beardedgit
    Member
    Posted 1 year ago #

    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 http://beardedgit.com/wp-content/uploads/2014%20Misc/oldtinymce.jpg

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.