WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] mce_thref in tinymce? (5 posts)

  1. nathanielstern
    Member
    Posted 6 years ago #

    Have been editing a plugin where I'm trying to use a combo of lightbox and flickrphp - don't know much about it, but the editing seems to be working... Anyhow, I'm putting links in the title attribute of a lightbox href, and it works great when I'm not using the rich editor, but as soon as I save or switch to visual vs code, all my "href"s turn to "mce_thref"s within that code. Oddly, it does this nowhere else, and stops doing it if i put spaces in my code (but then the link doesn't work any more!). Any remedies? Or is the rich text editor just completely out if I want to do this....?

    Thanks so much!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Sounds like a TinyMCE bug. TinyMCE has weirdness sometimes with various flavors of Firefox. I'll bet it works fine in IE.

    Anyway, no certain fix yet. Generally WordPress attempts to fix these issues by upgrading the whole of TinyMCE.

  3. nathanielstern
    Member
    Posted 6 years ago #

    erg. I'm on a Mac... So should I just upgrade TinyMCE from their site? Given that wordpress is only a week or so old, won't it have the most recent version of TinyMCE? Thanks again...

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    I'm on a Mac...

    Okay, then are you using Firefox or Safari? Whichever it is, try the other one and see if it still happens.

    And yes, WordPress is using one of the latest versions of TinyMCE, but that doesn't mean that it's bug-free. No piece of software is bug free.

  5. nathanielstern
    Member
    Posted 6 years ago #

    Safari works but not with TinyMCE, Firefox not all. SO, i just wrote my first plugin, and it seems to work. here goes, if anybody wants to use it. Just ignore the mce_thref - it'll get replaced when pulling the content from the database, as long as the plugin is activated. Yay, me.

    <?php
    /*
    Plugin Name: mce-firefox-fix
    Plugin URI: http://nathanielstern.com
    Description: Plugin to fix firefox bug in tinymce and phpflickr
    Date: 2007, October, 3
    Author: nathaniel stern
    Author URI: http://www.nathanielstern.com
    Version: 0.1
    */
    /*
    
    Author: nathaniel stern
    Website: http://www.nathanielstern.com
    
    */
    add_filter('the_content','mce_firefox_fix');
    
    function mce_firefox_fix($content) {
        $regex = '/\mce_thref/i';
    	preg_match_all( $regex, $content, $matches );
    	for($x=0; $x<count($matches[0]); $x++)
    	{
    			$replace = 'href';
    		$content = str_replace($matches[0][$x], $replace, $content);
    	}
    	return $content;
    }
    
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic