When choosing an image the preview in TinyMCE image browser window does not change.

Adding following code fixes that bug:

try {
      imceVar['targetField'].fireEvent('onchange');
  }
  catch (evt) {
      var newEvt = document.createEvent("Events");
          newEvt.initEvent('change',false,true);
          imceVar['targetField'].dispatchEvent(newEvt);
  }

It should be placed in imce_browse.js just after following lines in imceFinitor() function body:

imceVar['targetField'].value = path;
CommentFileSizeAuthor
imce_browse.js_.txt5.61 KBprond

Comments

mightyiam’s picture

This happens for me in 5.x-1.0. I don't know PHP or JavaScript.

I thought it may be because some hebrew translation found its way into the javascript. I got that idea from seeing that while I point at an image in the file manager, FireFox's status bar shows me "javascript: imceFinitor('/drupal/files/images/avatar.jpg', 85, 85, '2.69 ק". notice the last letter is hebrew. Its probably a part of the hebrew translation for "KB", which is "ק"ב".

I don't even know where the translation comes from. Is it the browser doing it?

druvision’s picture

Title: Slecting image does not fire onchange event in TinyMCE image browser window » Selecting image does not fire onchange event in TinyMCE image browser window

Search for the string and replace it with a string without quotes. Go to admin/settings/locale/string/search. I changed the translation to קילובייט, instead of ק"ב, and now it inserts the filename into the dialog. This is an immediate solution.

I will notify Yuval, who is responsible for the Hebrew translation, about the problem. This will hopefully go into the next translation.

Thanks alot for the lead to the solution.

Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | בניית אתרים
Personal: Hitech Dolphin: Regain Simple Joy :)

druvision’s picture

Status: Reviewed & tested by the community » Needs work

Please make validation on the 'KB' and only allow plain text on it.
This will premanently solve the issue for other languages as well.

yhager’s picture

@levavie, @DawnLight - I am not sure this is the same issue as originally reported. I opened another issue for the hebrew translation there and provided a patch. Please test it.

ufku’s picture

Status: Needs work » Closed (fixed)