开发者

Rails 3 and Tinymce: Displaying text editor only when focus is on text box?

Is it possible to only display a rich 开发者_Python百科text editor when the focus turns to a text area? I have a form with about 15 different text areas and i don't want each one displaying the editor tab when they are not in use.

Thanks


Yes, this is possible.

You will need to set the mode to "exact" in the tinymce init. Plus you will need to initialize the right tinymce editor when the textarea gets the focus.

$('#mytextarea').focus(function() {
  alert('Handler for .focus() called.');
  tinymce.execCommand('mceAddControl',true, $('#mytextarea').attr("id"));
});

To shut down an editor instance use:

tinymce.execCommand('mceRemoveControl',true, editor_id);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜