这个回调在2.0.3版本中被去除了。请用 execcommand_callback ,它还能重载其他操作比如插入图片和链接对话框。
这个选项可以让你重载内建的插入图像函数。选项应该包含一个函数名,当有新图像被插入到 TinyMCE 中时,函数会被执行。回调函数的格式是: insertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action)。大部分参数都能望文生义。action 参数可以是 "update" 或者 "insert" ,这取决与操作类型。函数返回一个与输入参数一样格式的数组。下面的例子展示了如何使用。这个选项默认为 TinyMCE 的内建函数。
insertimage_callback 选项的使用示例:
function myCustomInsertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action) {
var result = new Array();
// Do some custom logic
result['src'] = "logo.jpg";
result['alt'] = "test description";
result['border'] = "2";
result['hspace'] = "5";
result['vspace'] = "5";
result['width'] = width;
result['height'] = height;
result['align'] = "right";
result['title'] = "Some title";
result['onmouseover'] = "";
result['onmouseout'] = "";
return data;
}
tinyMCE.init({
...
insertimage_callback : "myCustomInsertImage"
});