我有以下 Tinymce 配置设置:
//set up a new editor function
setup : function(ed) {
//peform this action every time a key is pressed
ed.onKeyUp.add(function(ed, e) {
//setting our max character limit
tinymax = 10;
//grabbing the length of the curent editors content
content = ed.getContent();
var content_text = $(content).text();
var tinylen = content_text.length;
//if the user has exceeded the max, trigger enter and create a new paragraph
if (tinylen>tinymax){
var e = jQuery.Event("keydown");
e.which = 13; // Enter keyCode
$(".content").trigger(e);
}
}
不起作用的是触发事件。我在这里做错了什么?顺便说一下 (".content") 是文本区域的名称,我也试过 (ed) 并没有奏效。谢谢