Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TINYMCE set focus... just will not work

I've tried

tinyMCE.execInstanceCommand("content", "mceFocus");

I've tried

tinyMCE.execCommand('mceFocus', false, "content");

None of them seem to work :-(

like image 569
Lee Avatar asked Dec 28 '22 23:12

Lee


1 Answers

Well, I was stuck in the same problem. But I believe it depends where you execute the code. Here are various links that I've found so far:

http://tinymce.moxiecode.com/forum/viewtopic.php?id=8238

http://tinymce.moxiecode.com/forum/viewtopic.php?pid=91307#p91307


But I solved my issue the following, and it might not apply to yours:

this.focus();

this.tinymce.execCommand('mceFocus', false, 'yourTinyMCEtextAreaID_goes_here');

This code was applied inside the tiny_mce_src.js -> InsertHorizontalRule, just so you can have an idea of the scope.


Hope that helps.

like image 60
zeta Avatar answered Dec 30 '22 13:12

zeta