Resting TinyMCE
Permalink
First off, I've been developing a site in Concrete5 for a couple months now (side project for a friend) and am loving it.
There have been some challenges, as I have been trying to learn the code, learn PHP and develop new blocks to meet my friend's specific needs. I've been able to solve most of the problems (though probably not with the best solutions), but there is one that is still really bugging me.
Basically I wrote a "Testimonials" block. In one display mode, this block extracts all the entries from the db and prints them out. Seems easy enough, but I wanted to use the same TinyMCE editor that was used by the Content block. So, I hacked the the content interface, rebuilt it as custom tool and actually got things working the way I wanted.
Enter my friend... bless her soul... who says that she wants to include a picture with every entry.
Okay, I think, that's doable. I go back to the block and add in an extra tool that allows the user to bring up the media browser, select an image and then have that image attached to the entry record. All seemed well until...
I realized that there was a strange little bug. It seems that, anytime I call the TinyMCE editor tool that I had created, the Media Browser goes on the fritz. Basically, if the editor is opened before the Media Browser, the Media Browser will still open fine, but when I go to select an image, the page will throw a JavaScript error in my face. The error is as follows:
t.win.document is null
After some research and digging, I figured out that the problem comes from the TinyMCE editor, which redefines tinyMCE.init. As far as I can tell, it is this redefinition which is causing the problem. I've tried to figure out how to revert the values, but so far I've had no luck.
Before the execution of the editor, I save the value of tinyMCE.init, which of course gives me all the function code, but does not actually reset anything. I suppose that I could try to execute the function, but based on the code, the function accepts a value tinyMCE.init(s), and I have no idea what s is. Obviously, if I try to execute the function without supplying s, things will very likely blow up.
Does anyone know what's going on here? Or how I can reset things? I do have another solution in mind, but I feel that I am almost all the way there on this one, and would prefer to see it all the way through.
Thanks.
Matt
There have been some challenges, as I have been trying to learn the code, learn PHP and develop new blocks to meet my friend's specific needs. I've been able to solve most of the problems (though probably not with the best solutions), but there is one that is still really bugging me.
Basically I wrote a "Testimonials" block. In one display mode, this block extracts all the entries from the db and prints them out. Seems easy enough, but I wanted to use the same TinyMCE editor that was used by the Content block. So, I hacked the the content interface, rebuilt it as custom tool and actually got things working the way I wanted.
Enter my friend... bless her soul... who says that she wants to include a picture with every entry.
Okay, I think, that's doable. I go back to the block and add in an extra tool that allows the user to bring up the media browser, select an image and then have that image attached to the entry record. All seemed well until...
I realized that there was a strange little bug. It seems that, anytime I call the TinyMCE editor tool that I had created, the Media Browser goes on the fritz. Basically, if the editor is opened before the Media Browser, the Media Browser will still open fine, but when I go to select an image, the page will throw a JavaScript error in my face. The error is as follows:
t.win.document is null
After some research and digging, I figured out that the problem comes from the TinyMCE editor, which redefines tinyMCE.init. As far as I can tell, it is this redefinition which is causing the problem. I've tried to figure out how to revert the values, but so far I've had no luck.
Before the execution of the editor, I save the value of tinyMCE.init, which of course gives me all the function code, but does not actually reset anything. I suppose that I could try to execute the function, but based on the code, the function accepts a value tinyMCE.init(s), and I have no idea what s is. Obviously, if I try to execute the function without supplying s, things will very likely blow up.
Does anyone know what's going on here? Or how I can reset things? I do have another solution in mind, but I feel that I am almost all the way there on this one, and would prefer to see it all the way through.
Thanks.
Matt