TinyMCE & C5, problem inserting content

Permalink
This is driving me nuts... I have a strange error with C5's implementation of TinyMCE.. i'm trying to insert content from an OnClick event through a function using this code:

function insertHtml(thehtml) {
tinyMCE.execCommand(\'mceInsertRawHTML\', false, thehtml);
}

But it doesn't insert it on the first click, it always takes TWO clicks of the onClick link.. which is:

<a href="#" onClick="return insC(\'<p>Test</p>\');">

I've spent the last 4-5 hours trying various methods of doing this and it all ends up the same... i've also tryed adding "tinyMCE.activeEditor.focus();" to the function, which seemed like the most logical cause of the problem.. but it's still not working.

Does C5 have its own special way of inserting content into TinyMCE? I've been trying to break-down the code for the Content block but it seems to be using jQuery as a differn't method... it's giving me a headache!

Someone please help!!!!

Thanks.

 
Pixeled replied on at Permalink Reply
I still havn't solved this issue. Perhaps someone would be able to break down how C5 inserts content into tinyMCE from the filemanager/insert site link functions for me?

I'm looking at the code now, but it seems beyond me....
harunkaraman replied on at Permalink Reply
harunkaraman
This is strange, I also have problem with TinyMCE but different. Yours can be because of installation by scripts. Simple Script, Fantastico does not install and upgrade the C5 properly for sure. If you download and install it, it should work fine.

So, my recommendation is new installation.

Harun
http://www.kordil.com
Pixeled replied on at Permalink Reply
Thanks for your response, but i've already solved this problem after many hours of analysing the C5 code.

For anyone that may encounter this in the future, my solution was to use the "move to bookmark" TinyMCE function before placing content. So my code ended up as follows:

(javascript)
<script type="text/javascript">
   function insertRawHTML(html) {
      var mceEd = tinyMCE.activeEditor;
      mceEd.selection.moveToBookmark(bm);      
      mceEd.execCommand(\'mceInsertRawHTML\', false, html, true);
      $.fn.dialog.closeTop();   
   }
</script>