1

I am using a tinyMce editor in our website. At the first pageload I set an onkeypress event handler like this:

window.onload = function () {
    tinyMCE.activeEditor.onKeyPress.add(function () { startCookieInterval() });
    }

This works fine in firefox and chrome, but in opera it throws this javascript error:

Uncaught exception: TypeError: Cannot convert 'tinyMCE.activeEditor' to object

So I changed the window.onload to document.onload in case the tinyMce editor hasn't properly initialised by window.onload. This then works fine, up to the point where the event handler is called for the first time. Here I remove the event handler, because I only want to run it once:

function startCookieInterval() {
    tinyMCE.activeEditor.onKeyPress = null;
    cookieIntervalTick();
}

After this, on every keypress, the following javascript error occurs:

[07/05/1983 08:35:36] JavaScript - http://localhost:10166/4_advice_only/editadviceitem.aspx?ADIID=13127831
Event thread: keypress
Uncaught exception: TypeError: Cannot convert 'v[x[t.fakeType || t.type]]' to object
Error thrown at line 8641, column 20 in r(t, A) in http://localhost:10166/includes/tiny_mce_3_3_8/tiny_mce.js:
    v[x[t.fakeType || t.type]].dispatch(v, t, A)
called via Function.prototype.call() from line 3686, column 16 in <anonymous function: g>(n) in http://localhost:10166/includes/tiny_mce_3_3_8/tiny_mce.js:
    return l.call(j, n)

None of this happens in any other browsers. Please share your thoughts. Thanks

hofnarwillie

Chad von Nau
  • 4,118
  • 1
  • 19
  • 30
hofnarwillie
  • 3,353
  • 9
  • 45
  • 68
  • Regarding "changed window.onload to document.onload" - it seems you're misunderstanding something here. http://stackoverflow.com/questions/588040/window-onload-vs-document-onload/2445322 – hallvors Mar 15 '12 at 12:41
  • Could you put this on a server where I could look at it? Sounds quite odd.. – hallvors Mar 15 '12 at 12:42
  • @hallvors "misunderstanding something here", That link doesn't quite explain your comment. What am I misunderstanding? It supports my comment that window.onLoad and document.onLoad fire at different stages. – hofnarwillie Mar 17 '12 at 21:39
  • Sorry, I should probably have posted a direct link to http://my.opera.com/hallvors/blog/2009/05/20/the-day-supporting-document-onload-became-a-bug instead. Basically, assigning to document.onload doesn't do anything. – hallvors Mar 21 '12 at 15:24
  • (And I'd still really appreciate an opportunity to investigate this if you could share a link or put the code somewhere public) – hallvors Mar 21 '12 at 15:24

1 Answers1

0

Opera is not fully supported by Tinymce. This might be the reason for your error.

Thariama
  • 47,807
  • 11
  • 127
  • 149
  • Hi, thanks for your quick response. Could you point me in the direction of where I can verify this to justify it to a client, because the tinyMCE website seems to say that Opera is fully supported. http://www.tinymce.com/wiki.php/Browser_compatiblity – hofnarwillie Mar 06 '12 at 10:07
  • hmm, i just checked the core code. there was a code comment which stated that a function did not work for opera, but i haven't been able to verify this now. maybe moxiecode fixed this in the meantime. in order to be able to find the error, could you use the noincompressed tinymce version (this is the one in the developer download called tiny_mce_dev.js). Using this file it is much easier to track down errors. – Thariama Mar 06 '12 at 11:15
  • 1
    Thanks for the suggestion. I will play around with it when I get a chance and report back. – hofnarwillie Mar 06 '12 at 12:02