HI,

I am trying to setup IMCE, but no luck so far. I see an error in the Javascript console of Safari 3 which says there is an undefined value error in line 7 of imce_set_tinymce.js

Does not work in Firefox either...

Not sure what to do.

Thanks,
Eric

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aitala’s picture

As an addition.. here is the JS line at the end of the page before the body end tag

<script type="text/javascript"> var imceBrowserURL = "/main/imce/browse"; </script><script type="text/javascript" src="/main/sites/all/modules/imce/imce_set_tinymce.js"></script>

Also, I am using it with tinyMCE 3.0b2 and the 5.x-1.9 Drupal module

flajsg’s picture

Same here!

I'm using IMCE module with tinyMCE (all latest versions) and can't get image browse icon in imce image browser.

The problem is in file modules/imce/imce_set_tinymce.js

...somehow tinyMCE object doesn't have configs properties:

function imceInitiateTinyMCE() {
  if ("undefined" != typeof(window.tinyMCE)) {  	
    for (var i=0; i<tinyMCE.configs.length; i++) {   //<-- here's an error (tinyMCE.configs has no properties)
      tinyMCE.configs[i]['file_browser_callback'] = 'imceImageBrowser';      
    }
    
    setTimeout('for (var i in tinyMCE.instances) {var fE = tinyMCE.instances[i]["formElement"]; if (fE["tagName"]=="DIV")   tinyMCE.instances[i]["formElement"] = fE.firstChild;}', 3000);//fix formElement issue of tinymce after 3sec. comment out this line if you use tinymce2.1 or above.
  }
}

thanks for any help,
Gregor.

markstos’s picture

I also ran into this with TinyMCE 3. I tried TinyMCE 2, but it reported different errors.

jwurster’s picture

I also have the same error after installing IMCE and TinyMCE. I hope someone can find a solution.

aitala’s picture

Just to let folks know, at some point I have successfully gotten IMCE and TinyMCE to work together, I just don't remember offhand which version of each I used.. Been moving to a newer server, so I have not gotten back to it.

Eric

jorre’s picture

well, same error here... still no solution for this?

it's too bad that this functionality is just plain standard in wordpress... and in drupal it's been a hell...
seems like it's the same errors I got years ago with drupal

aitala’s picture

Just to let folks know, I am currently using Drupal 5.7, the FCKEditor 5.x-2.0-beta Drupal module, the IMCE 5.x-1.x-dev Drupal module, with FCKEditor Version 2.5.1 successfully.

It also worked with TinyMCE but I kinds like FCK better.

Eric

ChrisKennedy’s picture

Title: JS error in line 7 » JS error: tinyMCE.configs has no properties

I think this may be due to an updated version of TinyMCE (v3) - I changed it from tinyMCE.configs to tinyMCE.settings and the error goes away. I'm not sure if this is the correct solution though.

ChrisKennedy’s picture

Status: Active » Needs review
FileSize
1.74 KB

Ok here is a proper patch to get IMCE working again under TinyMCE 3.0.

ChrisKennedy’s picture

Title: JS error: tinyMCE.configs has no properties » Fix js error & browse button in TinyMCE 3.0
ledelboy’s picture

The patch didn't work for me, but I found a quick solution. What I did successfully was downgrading TinyMCE from 3.0 to 2.1.3 That version was working like a charm in an identical installation (5.7), and as soon as I did the change it began working fine.

csc4’s picture

There seem to be two very similar patches - this one and the one at http://drupal.org/node/178855#comment-701873

They're so similar it I don't know which one is 'right' - especially as reviewers in this thread seem think this version doesn't solve the problem.

I don't know which to apply! (or even if the right answer should be a combination of the two?)

ChrisKennedy’s picture

My version is the correct way to fix the problem, and should work - if it doesn't let me know. Make sure you do a hard refresh or clear your cache after you apply it so that your browser doesn't use the old version.

The version in the other thread is not a clean way to fix the bug and will cause issues when you either upgrade TinyMCE or disable IMCE at some point in the future.

wimvanloon’s picture

Change the line in the patch:

if (version >= 3) {

to:

if (parseInt(version) >= 3) {

and it should work with tinyMCE 3.0

chuseq’s picture

Got it to work with Chris' patch but with this modification:

    if (version >= 3) {
        tinyMCE.settings.file_browser_callback = "imceImageBrowser";
    }  ...

That is without the $.each. Honestly I don't know if the $.each is necessary, but it worked, now I can see the browse button.

I have drupal-5.7 and latest tinymce and imce.

Thanks.

fidoboy’s picture

It doesn't work for me, i've tried Chris patch, then applied Chuseq modifications, but it doesn't show the browse button, I've also another problem, i need 'insert image' dialog more width, how can i modify it?

regards,

abhijit-1’s picture

FileSize
1.25 KB

First, the patch file is a diff file. It's not a file that can be dropped into a folder.

Second, the patched code has an error -
The line
if (version >= 3) {
should actually be
if (version >= "3") {

This is so that when the version is something like "3.0.1" the comparison still succeeds.

I'm copying the entire correct code below.

Go to your /module/imce directory and open the file named "imce_set_tinymce.js"

Just copy and paste the code below into that file and save it. Everything should be fine now.

// Code begins
// $Id: imce_set_tinymce.js,v 1.1.2.4 2007/05/15 14:29:56 ufku Exp $
if (Drupal.jsEnabled) {
$(window).load(imceInitiateTinyMCE);
}

function imceInitiateTinyMCE() {
if ("undefined" != typeof(window.tinyMCE)) {

var version = tinymce.majorVersion +"."+ tinymce.minorVersion;

if (version >= "3") {
$.each(tinyMCE.editors, function() {
this.settings.file_browser_callback = "imceImageBrowser";
});
}
else {
for (var i=0; i tinyMCE.configs[i]['file_browser_callback'] = "imceImageBrowser";
}
}
if (version < 2.1) {
setTimeout('for (var i in tinyMCE.instances) {var fE = tinyMCE.instances[i]["formElement"]; if (fE["tagName"]=="DIV") tinyMCE.instances[i]["formElement"] = fE.firstChild;}', 3000);
}
}
}

var imceTinyWin, imceTinyField, imceTinyType, imceTinyURL;
function imceImageBrowser(field_name, url, type, win) {
//if (type!='image') return;//work for only images
var width = 640;
var height = 480;
var imcePopup = window.open(imceBrowserURL, '', 'width='+ width +', height='+ height +', resizable=1');
imcePopup.focus();
imceTinyWin = win;
imceTinyField = win.document.forms[0].elements[field_name];
imceTinyType = type;
imceTinyURL = url;
}

// Code ends

I'm also attaching the modified file with this post which you can drop into your modules/imce folder and overwrite the one currently there

abhijit-1’s picture

First, the patch file is a diff file. It's not a file that can be dropped into a folder.

Second, the patched code has an error -
The line
if (version >= 3) {
should actually be
if (version >= "3") {

This is so that when the version is something like "3.0.1" the comparison still succeeds.

I'm copying the entire correct code below.

Go to your /module/imce directory and open the file named "imce_set_tinymce.js"

Just copy and paste the code below into that file and save it. Everything should be fine now.

// Code begins
// $Id: imce_set_tinymce.js,v 1.1.2.4 2007/05/15 14:29:56 ufku Exp $
if (Drupal.jsEnabled) {
$(window).load(imceInitiateTinyMCE);
}

function imceInitiateTinyMCE() {
if ("undefined" != typeof(window.tinyMCE)) {

var version = tinymce.majorVersion +"."+ tinymce.minorVersion;

if (version >= "3") {
$.each(tinyMCE.editors, function() {
this.settings.file_browser_callback = "imceImageBrowser";
});
}
else {
for (var i=0; i tinyMCE.configs[i]['file_browser_callback'] = "imceImageBrowser";
}
}
if (version < 2.1) {
setTimeout('for (var i in tinyMCE.instances) {var fE = tinyMCE.instances[i]["formElement"]; if (fE["tagName"]=="DIV") tinyMCE.instances[i]["formElement"] = fE.firstChild;}', 3000);
}
}
}

var imceTinyWin, imceTinyField, imceTinyType, imceTinyURL;
function imceImageBrowser(field_name, url, type, win) {
//if (type!='image') return;//work for only images
var width = 640;
var height = 480;
var imcePopup = window.open(imceBrowserURL, '', 'width='+ width +', height='+ height +', resizable=1');
imcePopup.focus();
imceTinyWin = win;
imceTinyField = win.document.forms[0].elements[field_name];
imceTinyType = type;
imceTinyURL = url;
}

// Code ends

lordlex’s picture

Hi,

I get this error even with the code in #18...

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www.XXXX.com/dev/sites/all/modules/imce/imce_set_inline.js :: imceInsertAtCursor :: line 32" data: no]

The button do to apear in tinyMCE image insert dialog.
I have Drupal 5.7, tinymce-5.x-1.9 with TinyMCE 3.0.3

LATER EDIT: i get this error only when tinymce is active... when it is not active it insert the links to the images...

lordlex’s picture

After patch http://drupal.org/node/178855#comment-701873 i button apear but when i press it i have this on firebug and no window open:

f has no properties
[Break on this error] return f.apply(s || t, Array.prototype.slice.call(arguments, 1));

this is in file tiny_mce.js (i renamed tiny_mce_src.js to see the line - 6701)

patogalla’s picture

I have the same problem as #20, i tried changing the way the settings are set, but nothing happens, and the same error is showing up. If someone could give me a hand or orientation of what the problem could be i'd be grateful!
Thnaks a lot anyway for this thread, i found it very useful

Details of the bug:

f has no properties
[Break on this error] eval.call(w, co);

edg’s picture

I first installed abhijit #17 and then Chris's patch #9 but still getting the same error.

The problem I'm experiencing with TinyMCE v3 seems to be different from some of the above posters who can't see the browse button. I can browse for images, but when I click to "add" them to the text field the preview window goes blank and the image is not inserted. If I insert the img path in the dialogue box within TinyMCE itself then it automatically sets the width and height as per normal, but when I close the image dialogue box and then submit the Story, the width, height and alignment settings are lost and the page design looks bad.

I'm using 5.7 and latest version of IMCE and latest Drupal TinyMCE module (with TinyMCE v 3). It seems like more than one problem, but maybe others are experiencing similar issues?

ufku’s picture

Status: Needs review » Fixed

thanks for the patches. the fix is included in 5.x-1.1 version. [#239296]

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

mjourney2’s picture

It appears that the same issue exists in the 6x version. But there is no file imce_set_inline.js, unless I'm missing it somehow?

Thanks