views:

188

answers:

1

I have successfully setup tinymce to work on a page within an iframe. Everything works perfectly.

However, when you use imagemanager to pick an image to be inserted or replaced in the editor it will not copy the path(and filename) of the image to the "Image URL" input in the "Insert/edit image" box. The box will either remain empty or keep the address of the previous image.

The behaviour is the same with the filemanager plugin.

tinyMCE.init(    
{    
    mode : "none",    
    editor_selector : "mceEditor",    
    theme : "advanced",    
    plugins : "filemanager,imagemanager,autoresize,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,spellchecker",    
    theme_advanced_buttons1 : "insertfile,insertimage,advimage,imagemanager,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,nonbreaking,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist",    
    theme_advanced_buttons2 : "blockquote,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,|,forecolor,backcolor,|,charmap,iespell,media,advhr",    
    theme_advanced_layout_manager : "SimpleLayout",    
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,strikethrough",    
    theme_advanced_buttons4 : "styleselect,formatselect,fontselect,fontsizeselect,|,undo,redo,|,spellchecker",    
    theme_advanced_toolbar_location : "external",    
    theme_advanced_toolbar_align : "left",    
    theme_advanced_statusbar_location : "bottom",    
    relative_urls : true,    
    document_base_url : "http://xxxxxxxxxxx.com/",    
    auto_resize : true,    
    content_css : "/custom/css/style.css",    
    extended_valid_elements : "iframe[height|width|src|frameborder|scrolling]",    
});    

/*    
    The following code comes from- http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12966    
    Without it the editor only loads 10% of the time. With it, it's pretty much 100% consistent.    
    The other changes mentioned in the post have also been implemented.    
*/    
var setupTiny = function()    
{    
    var ifrObj = document.getElementById('pageEditIFrame');    
    var win = ifrObj;    
    if (win.contentWindow)    
    {    
        win = win.contentWindow;    
    }    

    var d;    
    if(ifrObj.contentDocument)    
    {    
        d = ifrObj.contentDocument;    
    }    
    else if (ifrObj.contentWindow)    
    {    
        d = ifrObj.contentWindow.document;    
    }    
    else if (ifrObj.document)    
    {    
        d = ifrObj.document;    
    }    

    textAreas.each(function(txtEl)    
    {    
        tinyMCE.execCommand('mceAddFrameControl', false,    
        {    
            element_id : txtEl,    
            window : win,    
            doc : d    
        });    
    });    
};    

//Waiting 1 second seems to make the editor load more reliably.    
setTimeout("setupTiny();",1000);
A: 

I ran across a similar issue that only shows up in more recent versions of Firefox - Chrome and IE work fine for me. Not sure if it is exactly the same problem (I'm not using iframes) but it presents in the same way.

Here's where I found my solution: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=23302

As you can read there, one of the coders for TinyMCE thinks its a bug in FF, though the fixes look more like it's tiny_mce assuming a bug still exists in Firefox that was fixed at some point in 3.5. Here's the solution that worked for me (quoted from the post):

1) Go to tiny_mce.js

2) Find this line: this.isGecko = ua.indexOf('Gecko') != -1;

under it add:

this.isGecko369 = (this.isGecko && ua.indexOf('irefox/3.6.')!= -1 && parseInt(ua.substr(ua.indexOf('irefox/3.6.')+11,2)) >= 9);
this.isGecko369 = (this.isGecko369 || (this.isGecko && ua.indexOf('irefox/3.5.')!= -1 && parseInt(ua.substr(ua.indexOf('irefox/3.5.')+11,2)) >= 9 ) );

3) Find this line: fixGeckoBaseHREFBug : function(m, e, h) {

below that there is this line: if (tinyMCE.isGecko) { alter it with: if (tinyMCE.isGecko && !tinyMCE.isGecko369) {

Drew Miller