AJAX replacing causes g.win.document is null error after TinyMCE Update to 3.3.2

165 views
Skip to first unread message

tvdeyen

unread,
Apr 6, 2010, 7:18:09 AM4/6/10
to tinymce_hammer
After saving via ajax and dynamically replacing it causes a:

TypeError: g.win.document is null

I found this thread in tinymce forums:

http://tinymce.moxiecode.com/punbb/viewtopic.php?id=11254

spocke says something about messed up editor instances?

Maybe it has something to do with replacing the editor via javascript
after saving it via ajax.

What is the best way to initialize an editor after adding it
dynamically?
I call TinymceHammer.init() after replacing the editor and this worked
great until I updated the tinymce to version 3.3.2

Some ideas?

tvdeyen

unread,
Apr 6, 2010, 7:29:00 AM4/6/10
to tinymce_hammer
Something has to be missed in the TinymceHammer.init() function!

For testing I removed the init function and the editor does not show
up (only the textarea as expected). After posting the form via ajax,
the error appears.
If I load the page via Browser refresh everything works fine. Just
after the TinymceHammer.init function call something breaks. Maybe
initializing the textareas dynamically was changed in tinymce 3.3.2?

I try to revert to older tinymce version for now. Maybe this helps.

tvdeyen

unread,
Apr 6, 2010, 7:41:08 AM4/6/10
to tinymce_hammer
Hmm, sadly reverting to tinymce 3.2.7 did not fixed this.
So, calling TinymceHammer.init() after ajax replacing does not work!
So waht is the best way to replace an editor dinamically after ajax
saving?

I really depend on this, so any clues are very much appreciated!

I'll will try my old fork on github for this now. Maybe together we'll
find a way to fix this mayor issue!

THANKS!

tvdeyen

unread,
Apr 6, 2010, 9:07:55 AM4/6/10
to tinymce_hammer
Finally I solved this :)

I have to remove the editor instance before initializing it again
with:

tinyMCE.execCommand('mceRemoveControl',true,'the_id_of_the_textarea');

Found the solution here:

http://www.handgestrickt.biz/index.php?postid=74

Me Stupid :)

regards


thomas

Reply all
Reply to author
Forward
0 new messages