TINYMCE 设定焦点...只是行不通
我已经尝试过,
tinyMCE.execInstanceCommand("content", "mceFocus");
我已经尝试过,
tinyMCE.execCommand('mceFocus', false, "content");
但似乎都不起作用:-(
I've tried
tinyMCE.execInstanceCommand("content", "mceFocus");
I've tried
tinyMCE.execCommand('mceFocus', false, "content");
None of them seem to work :-(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我陷入了同样的问题。但我相信这取决于您执行代码的位置。以下是我迄今为止找到的各种链接:
http://tinymce.moxiecode .com/forum/viewtopic.php?id=8238
http ://tinymce.moxiecode.com/forum/viewtopic.php?pid=91307#p91307
但是我解决了以下问题,它可能不适用于您的问题:
this.focus( );
this.tinymce.execCommand('mceFocus', false, 'yourTinyMCEtextAreaID_goes_here');
此代码应用于tiny_mce_src.js -> InsertHorizontalRule,这样您就可以了解范围。
希望有帮助。
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.
有一种比之前建议的代码更简单的方法。初始化tinymce时,有一个选项可以设置配置参数。只需确保您设置了自动对焦选项即可。
There is an even simpler way than the previous suggested code. When you initialize tinymce, there is an option to set the configuration parameters. Just make sure that you set the AUTOFOCUS option.